Created
February 21, 2016 17:47
-
-
Save sandeepkunkunuru/ea39120dd462ea0b73f5 to your computer and use it in GitHub Desktop.
Checkout all your github repos in one go
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/bash | |
#script to get all repositories under a user from github | |
#Usage: github.sh [username] | |
curl -u ${1} https://api.github.com/users/${1}/repos > repoinfo | |
for repo_name in $( grep -oE '\"name\": "[^"]*"' repoinfo | cut -f4 -d\") | |
do | |
if [[ -d "${repo_name}" ]]; then | |
pushd "${repo_name}" | |
git pull origin master | |
popd | |
else | |
git clone [email protected]:${1}/${repo_name}.git | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment