From a78560944934d7728ae8d2949a5201487c0e4867 Mon Sep 17 00:00:00 2001 From: Raghuram Subramani Date: Wed, 15 Oct 2025 16:18:19 -0400 Subject: add hooks to clones --- clone | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'clone') diff --git a/clone b/clone index 673f0d7..8d12f04 100755 --- a/clone +++ b/clone @@ -5,6 +5,8 @@ if [ $# -ne 1 ]; then exit 1 fi +set -xe + USER="compromyse" base_dir="$HOME" @@ -24,5 +26,19 @@ if [ -d "$new_repo" ]; then fi mkdir "$new_repo" -git clone --bare "git@github.com:$USER/$1" "$new_repo" \ - && echo "Cloned Git repository to: git@$(uname -n):$1" +git clone --bare "git@github.com:$USER/$1" "$new_repo" + +pushd $new_repo > /dev/null + + for remote in $(git remote show); do + git remote remove $remote + git remote add github git@github.com:$USER/$1 + git fetch github + done + + echo "$description" > description + + echo 'git push github -f --mirror' > "hooks/post-receive" + chmod +x "hooks/post-receive" +popd > /dev/null + -- cgit v1.2.3