Skip to content

Instantly share code, notes, and snippets.

@sandeepkunkunuru
Created February 21, 2016 17:47
Show Gist options
  • Save sandeepkunkunuru/ea39120dd462ea0b73f5 to your computer and use it in GitHub Desktop.
Save sandeepkunkunuru/ea39120dd462ea0b73f5 to your computer and use it in GitHub Desktop.
Checkout all your github repos in one go
#!/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 git@github.com:${1}/${repo_name}.git
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment