#!/bin/sh set -eux if [ -d .git ] ; then git gc --aggressive --prune=now REPO="$(basename $(git rev-parse --show-toplevel))" cd .. else [ -n "$1" ] || exit 1 REPO="$1" (cd "$REPO" git gc --aggressive --prune=now ) fi GITDIR="$(readlink -f "${REPO}").git" git clone --bare "$REPO" "${GITDIR}" (cd "${GITDIR}" # shellcheck disable=SC3045 read -r -e -p "Describe the repository:" DESC echo "$DESC" >description touch git-daemon-export-ok git config --add gitweb.owner 'Matěj Cepl ' git remote rm origin || /bin/true ) rsync -avz "${GITDIR}" redcrew:private_git/ rm -rf "${GITDIR}" cd "$REPO" git remote add myrepo "redcrew:private_git/${REPO}.git" git remote update git push --all -u myrepo