blob: 26155164893cf843ecc14abc53dea7bd1b247e07 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
#!/usr/bin/env bash
set -xe
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
echo 'git push github -f --mirror' > "hooks/post-receive"
chmod +x "hooks/post-receive"
popd > /dev/null
fi
done
|