From 8f4e7304e6be91a45300f813faa9ffb9c7436144 Mon Sep 17 00:00:00 2001 From: Raghuram Subramani Date: Wed, 15 Oct 2025 18:38:33 -0400 Subject: add setup-receive-hook --- help | 1 + init | 4 ++-- setup-receive-hook | 30 ++++++++++++++++++++++++++++++ setup-receive-hooks | 10 ++++++++++ setup-recieve-hooks | 10 ---------- 5 files changed, 43 insertions(+), 12 deletions(-) create mode 100755 setup-receive-hook create mode 100755 setup-receive-hooks delete mode 100755 setup-recieve-hooks diff --git a/help b/help index 2171cee..ebb1d82 100755 --- a/help +++ b/help @@ -12,5 +12,6 @@ unignore bash clone-all-github setup-receive-hooks +setup-receive-hook setup-remote """ diff --git a/init b/init index 61605c0..8f82adb 100755 --- a/init +++ b/init @@ -27,5 +27,5 @@ mkdir "$new_repo" git init --bare "$new_repo" >/dev/null 2>&1\ && echo "Initialized empty Git repository: git@$(uname -n):$1" -echo 'git push github -f --mirror' > "$new_repo/hooks/post-receive" -chmod +x "$new_repo/hooks/post-receive" +# echo 'git push github -f --mirror' > "$new_repo/hooks/post-receive" +# chmod +x "$new_repo/hooks/post-receive" diff --git a/setup-receive-hook b/setup-receive-hook new file mode 100755 index 0000000..4fd25b4 --- /dev/null +++ b/setup-receive-hook @@ -0,0 +1,30 @@ +#!/usr/bin/env bash + +if [ $# -ne 1 ]; then + echo "usage: setup-receive-hook " + exit 1 +fi + +set -xe + +USER="compromyse" + +base_dir="$HOME" +repo="${base_dir}/$1" + +case $repo in + *\.git) + ;; + *) + repo="${new_repo}.git" + ;; +esac + +if [ ! -d "$repo" ]; then + echo "$repo does not exist" + exit 1 +fi + +cd $repo +echo 'git push github -f --mirror' > "$new_repo/hooks/post-receive" +chmod +x "$new_repo/hooks/post-receive" diff --git a/setup-receive-hooks b/setup-receive-hooks new file mode 100755 index 0000000..dbaad48 --- /dev/null +++ b/setup-receive-hooks @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +set -xe + +REPOSITORIES=$(find /home/git/* -name '*.git' -type d) + +for repo in $REPOSITORIES; do + echo 'git push github -f --mirror' > "$repo/hooks/post-receive" + chmod +x "$repo/hooks/post-receive" +done diff --git a/setup-recieve-hooks b/setup-recieve-hooks deleted file mode 100755 index dbaad48..0000000 --- a/setup-recieve-hooks +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env bash - -set -xe - -REPOSITORIES=$(find /home/git/* -name '*.git' -type d) - -for repo in $REPOSITORIES; do - echo 'git push github -f --mirror' > "$repo/hooks/post-receive" - chmod +x "$repo/hooks/post-receive" -done -- cgit v1.2.3