Created
February 1, 2016 01:16
-
-
Save nuta/eef2ef0ca4970011c8e9 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
| #!/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