Skip to content

Instantly share code, notes, and snippets.

@chbrandt
Last active December 12, 2017 22:36
Show Gist options
  • Save chbrandt/233a3116e2e6b6fd05c5ccd8d1dc01a0 to your computer and use it in GitHub Desktop.
Save chbrandt/233a3116e2e6b6fd05c5ccd8d1dc01a0 to your computer and use it in GitHub Desktop.
Download all 'user' repositories from github
# Get the list of (<100) repositories from user 'fulano' from github
# Using curl, goes like:
#$ curl https://api.github.com/users/fulano/repos?per_page=100 > github_repos.json
#
import subprocess
with open('github_repos.json','r') as fp:
import json
repos = json.load(fp)
for r in repos:
if not os.path.isdir(r['name']):
proc = subprocess.Popen(['git','clone',r['ssh_url']])
output = proc.communicate()
else:
print('Repository {} already cloned'.format(r['name']))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment