diff options
Diffstat (limited to 'gitea-mirror/gitea-mirror')
-rwxr-xr-x | gitea-mirror/gitea-mirror | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/gitea-mirror/gitea-mirror b/gitea-mirror/gitea-mirror new file mode 100755 index 0000000..527df11 --- /dev/null +++ b/gitea-mirror/gitea-mirror @@ -0,0 +1,25 @@ +#!/bin/sh +# based on https://github.com/miracle2k/gitolite-simple-mirror/blob/master/post-receive + +# simple gitolite mirroring + +# flush STDIN coming from git, because gitolite's own post-receive.mirrorpush +# script does the same thing +[ -t 0 ] || cat >/dev/null + +if [ -z "${GL_REPO}" ]; then + echo "GL_REPO not set" >&2 + exit 1 +fi + +targets=$(git config --get gentoo.mirror.url) +[ -z "${targets}" ] && exit 0 + +export GIT_SSH_KEY=$(git config --get gentoo.mirror.pubkey) +: ${GIT_SSH_KEY:=/home/antarus/gitea-mirror/gentoo-gitea.ssh.priv} +export GIT_SSH=./gitea-ssh-wrapper + +for target in ${targets}; do + # --force because someone may accidentally push into the mirror + git push --mirror --force ${target} +done |