summaryrefslogtreecommitdiff
path: root/clone
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xclone20
-rwxr-xr-xclone-all-github4
2 files changed, 22 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