diff options
author | Alec Warner <antarus@gentoo.org> | 2022-03-29 18:39:07 -0700 |
---|---|---|
committer | Alec Warner <antarus@gentoo.org> | 2022-03-29 18:39:07 -0700 |
commit | f63f822dc3afc429988d2ddee2a164068df9f78a (patch) | |
tree | 34c4e6db8a4e8f2e010a0c6d815e7951dab422db /gitlab-mirror | |
parent | local/require-signed-push: raise clock drift limit (diff) | |
download | githooks-f63f822dc3afc429988d2ddee2a164068df9f78a.tar.gz githooks-f63f822dc3afc429988d2ddee2a164068df9f78a.tar.bz2 githooks-f63f822dc3afc429988d2ddee2a164068df9f78a.zip |
Update our wrappers.githooks-20220330T013907Z
Gitea, we do not support anymore.
Gitlab, we are starting to support.
Signed-off-by: Alec Warner <antarus@gentoo.org>
Diffstat (limited to 'gitlab-mirror')
-rwxr-xr-x | gitlab-mirror/gitlab-mirror | 24 | ||||
-rwxr-xr-x | gitlab-mirror/gitlab-ssh-wrapper | 4 |
2 files changed, 28 insertions, 0 deletions
diff --git a/gitlab-mirror/gitlab-mirror b/gitlab-mirror/gitlab-mirror new file mode 100755 index 0000000..5daf384 --- /dev/null +++ b/gitlab-mirror/gitlab-mirror @@ -0,0 +1,24 @@ +#!/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 gitlab.mirror.url) +[ -z "${targets}" ] && exit 0 + +[ -z "${GIT_SSH_KEY}" ] && export GIT_SSH_KEY=$(git config --get gitlab.mirror.pubkey) +export GIT_SSH=$(dirname "$(readlink -f "$0")")/gitlab-ssh-wrapper + +for target in ${targets}; do + # --force because someone may accidentally push into the mirror + git push --mirror --force ${target} +done diff --git a/gitlab-mirror/gitlab-ssh-wrapper b/gitlab-mirror/gitlab-ssh-wrapper new file mode 100755 index 0000000..5f4c1fc --- /dev/null +++ b/gitlab-mirror/gitlab-ssh-wrapper @@ -0,0 +1,4 @@ +#!/bin/sh +# Use via GIT_SSH + +exec ssh ${GIT_SSH_KEY:+-i} ${GIT_SSH_KEY} "$@" |