summaryrefslogtreecommitdiffstats
path: root/repo-specific/github-mirror
diff options
context:
space:
mode:
authorturret <turret@duck.com>2023-10-04 14:09:20 -0500
committerturret <turret@duck.com>2023-10-04 14:09:20 -0500
commit26719337d8d4bc58faddf6b574672af4d855ec0a (patch)
treeb1f5aee2063a7e980c48034f8717f31fc96b08db /repo-specific/github-mirror
parenta5e984df5ed5ec7a04558cd7b33bae43c0547f7a (diff)
downloadhooks-26719337d8d4bc58faddf6b574672af4d855ec0a.tar.gz
hooks-26719337d8d4bc58faddf6b574672af4d855ec0a.tar.bz2
hooks-26719337d8d4bc58faddf6b574672af4d855ec0a.zip
meta: organise into directory
Diffstat (limited to 'repo-specific/github-mirror')
-rwxr-xr-xrepo-specific/github-mirror24
1 files changed, 24 insertions, 0 deletions
diff --git a/repo-specific/github-mirror b/repo-specific/github-mirror
new file mode 100755
index 0000000..9223975
--- /dev/null
+++ b/repo-specific/github-mirror
@@ -0,0 +1,24 @@
+#!/bin/sh
+# based on https://cgit.gentoo.org/infra/githooks.git/plain/github-mirror/github-mirror
+
+# 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 mirror.url)
+[ -z "${targets}" ] && exit 0
+
+[ -z "${GIT_SSH_KEY}" ] && export GIT_SSH_KEY=$(git config --get mirror.pubkey)
+export GIT_SSH=$(dirname "$(readlink -f "$0")")/github-ssh-wrapper
+
+for target in ${targets}; do
+ # --force because someone may accidentally push into the mirror
+ git push --mirror --force ${target}
+done