summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xclone20
-rwxr-xr-xclone-all-github4
-rwxr-xr-xdesc2
-rwxr-xr-xhelp1
-rwxr-xr-xignore2
-rwxr-xr-xinit5
-rwxr-xr-xrm2
-rwxr-xr-xsetup-recieve-hooks10
-rwxr-xr-xunignore2
9 files changed, 46 insertions, 2 deletions
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
+
diff --git a/clone-all-github b/clone-all-github
index 739f8db..2615516 100755
--- a/clone-all-github
+++ b/clone-all-github
@@ -1,5 +1,7 @@
#!/usr/bin/env bash
+set -xe
+
USER=compromyse
REPOS=$(curl https://api.github.com/users/$USER/repos 2>/dev/null)
@@ -22,6 +24,8 @@ for i in $(seq 0 1 $(( $(echo $REPOS | jq length) - 1 ))); do
done
echo "$description" > description
+ echo 'git push github -f --mirror' > "hooks/post-receive"
+ chmod +x "hooks/post-receive"
popd > /dev/null
diff --git a/desc b/desc
index ed99ccc..e75bcbb 100755
--- a/desc
+++ b/desc
@@ -5,6 +5,8 @@ if [ $# -ne 1 ]; then
exit 1
fi
+set -xe
+
base_dir="$HOME"
repo="${base_dir}/$1"
diff --git a/help b/help
index 6412f50..c60e0ae 100755
--- a/help
+++ b/help
@@ -11,4 +11,5 @@ ignore <name>
unignore <name>
bash
clone-all-github
+setup-receive-hooks
"""
diff --git a/ignore b/ignore
index 54b988e..4e7984c 100755
--- a/ignore
+++ b/ignore
@@ -5,6 +5,8 @@ if [ $# -ne 1 ]; then
exit 1
fi
+set -xe
+
USER="compromyse"
base_dir="$HOME"
diff --git a/init b/init
index 34e48a5..61605c0 100755
--- a/init
+++ b/init
@@ -5,6 +5,8 @@ if [ $# -ne 1 ]; then
exit 1
fi
+set -xe
+
base_dir="$HOME"
new_repo="${base_dir}/$1"
@@ -24,3 +26,6 @@ fi
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"
diff --git a/rm b/rm
index 287f8ba..35ca85b 100755
--- a/rm
+++ b/rm
@@ -5,6 +5,8 @@ if [ $# -ne 1 ]; then
exit 1
fi
+set -xe
+
base_dir="$HOME"
target="$1"
diff --git a/setup-recieve-hooks b/setup-recieve-hooks
new file mode 100755
index 0000000..dbaad48
--- /dev/null
+++ b/setup-recieve-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/unignore b/unignore
index 76097ac..bedb343 100755
--- a/unignore
+++ b/unignore
@@ -5,6 +5,8 @@ if [ $# -ne 1 ]; then
exit 1
fi
+set -xe
+
USER="compromyse"
base_dir="$HOME"