diff options
Diffstat (limited to 'git2private')
-rwxr-xr-x | git2private | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/git2private b/git2private new file mode 100755 index 0000000..87e10f6 --- /dev/null +++ b/git2private @@ -0,0 +1,32 @@ +#!/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 <mcepl@cepl.eu>' + 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 |