Skip to content

Instantly share code, notes, and snippets.

@mehulkar
Last active August 29, 2015 14:07
Show Gist options
  • Save mehulkar/2bc4249ec2fd8042b353 to your computer and use it in GitHub Desktop.
Save mehulkar/2bc4249ec2fd8042b353 to your computer and use it in GitHub Desktop.
# Inspired by @mrmrs http://designbytyping.com/2014/10/17/cloning-repos/
user="mehulkar"
# curl the pages directly instead of saving
# the urls to a txt file first
for page in {1..3}; do
curl "https://api.github.com/users/$user/repos?page=$page&per_page=100" >> repos.json
done
for line in `cat repos.json`; do
# poor person's JSON parse
# wildcard matches lines that contain the string full_name
# obviously buggy if there are repos that contain the string full_name
if [[ $line == *full_name* ]]; then
##
# Need to figure out how to find repo name from
# the line the contains the url
# reponame=find the repo name from the link
##
# And then you can clone it
git clone "[email protected]:$user/$reponame"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment