Created
May 14, 2020 00:59
-
-
Save computercam/39b763df01762292aa446b84309c6097 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
tmp="`mktemp`" | |
url="https://api.github.com/users/ferrybig/repos?per_page=100" | |
while [ ! -z "$url" ]; do | |
echo "Fetching $url..." >&2 | |
curl --dump-header "$tmp" "$url" | |
url="`< "$tmp" grep Link | grep -oE "[a-zA-Z0-9:/?=.&_]*>; rel=.next" | cut -d'>' -f1`" | |
done | grep clone_url | cut -d'"' -f4 | while read url; | |
do | |
project="`basename "$url"`" | |
echo "Mirroring $project" | |
if [ -d "$project" ]; | |
then | |
cd "$project" | |
git fetch --prune | |
cd .. | |
else | |
git clone --mirror "$url" "$project" | |
fi | |
done | |
rm "$tmp" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment