-
-
Save snim2/5915d857910623b09d5e to your computer and use it in GitHub Desktop.
This file contains 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/bash | |
# Usage Example: $ clone-github github_id | |
# would clone all the git repositories managed under github_id at current path | |
# save it as /etc/profiles/a.github.sh | |
## | |
clone-github(){ | |
GITHUB_ID=$1 | |
GITHUB_REPO_URI="https://github.com/"$GITHUB_ID"?tab=repositories" | |
repos=`curl -skL $GITHUB_REPO_URI | grep 'title="Forks"' | sed "s/.*$GITHUB_ID\///" | sed 's/\/network"\stitle="Forks">//'` | |
for line in `echo $repos | xargs -L1`; | |
do | |
if [ ! -z $line ]; | |
then | |
repo_git='git://github.com/'$GITHUB_ID'/'$line'.git' | |
if [ -e $line ]; then | |
echo 'Fetching master latest pull for: '$repo_git | |
cd $line ; git pull ; cd - | |
else | |
echo "Cloning... "$repo_git | |
`git clone $repo_git` | |
fi | |
fi | |
done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment