diff options
-rwxr-xr-x | help | 1 | ||||
-rwxr-xr-x | init | 4 | ||||
-rwxr-xr-x | setup-receive-hook | 30 | ||||
-rwxr-xr-x | setup-receive-hooks (renamed from setup-recieve-hooks) | 0 |
4 files changed, 33 insertions, 2 deletions
@@ -12,5 +12,6 @@ unignore <name> bash clone-all-github setup-receive-hooks +setup-receive-hook <name> setup-remote <name> <remote_name> <remote> """ @@ -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 <name>" + 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-recieve-hooks b/setup-receive-hooks index dbaad48..dbaad48 100755 --- a/setup-recieve-hooks +++ b/setup-receive-hooks |