Skip to content

Instantly share code, notes, and snippets.

@nuta
Created February 1, 2016 01:16
Show Gist options
  • Select an option

  • Save nuta/eef2ef0ca4970011c8e9 to your computer and use it in GitHub Desktop.

Select an option

Save nuta/eef2ef0ca4970011c8e9 to your computer and use it in GitHub Desktop.
#!/usr/bin/env zsh
set -e
REPOS_DIR=/var/lib/git
USERS=(nuta resea biscket)
clone(){
x=$1
[ "${x[1,5]}" != "https" ] && echo invalid url "$x" && exit 1
base=$(basename "$x" | sed -e 's/.git$//')
echo "==> $x"
if [ ! -d "$base" ] ;then
git clone $x
else
cd $base; git fetch --all; cd ..
fi
}
cd $REPOS_DIR
for user in $USERS; do
url=https://api.github.com/users/$user/repos
for x in $(curl $url | grep clone_url | awk '{print $2}' | sed -e 's/"//'|sed -e 's/",//'); do
clone $x
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment