summaryrefslogtreecommitdiff
path: root/sync-github
diff options
context:
space:
mode:
Diffstat (limited to 'sync-github')
-rwxr-xr-xsync-github29
1 files changed, 29 insertions, 0 deletions
diff --git a/sync-github b/sync-github
new file mode 100755
index 0000000..739f8db
--- /dev/null
+++ b/sync-github
@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+
+USER=compromyse
+REPOS=$(curl https://api.github.com/users/$USER/repos 2>/dev/null)
+
+for i in $(seq 0 1 $(( $(echo $REPOS | jq length) - 1 ))); do
+ name=$(echo $REPOS | jq -r .[$i].name)
+ description=$(echo $REPOS | jq -r .[$i].description)
+
+ repo=$name.git
+
+ if [ ! -d $HOME/$repo ]; then
+
+ git clone --bare https://github.com/$USER/$repo $HOME/$repo
+
+ pushd $HOME/$repo > /dev/null
+
+ for remote in $(git remote show); do
+ git remote remove $remote
+ git remote add github git@github.com:$USER/$repo
+ git fetch github
+ done
+
+ echo "$description" > description
+
+ popd > /dev/null
+
+ fi
+done