Skip to content

Instantly share code, notes, and snippets.

@rjmholt
Last active January 3, 2017 04:51
Show Gist options
  • Save rjmholt/3f8fac4e38f7e72b660bcb3f0d10eef2 to your computer and use it in GitHub Desktop.
Save rjmholt/3f8fac4e38f7e72b660bcb3f0d10eef2 to your computer and use it in GitHub Desktop.
Clones all the repos of a GitHub user, using the GitHub API
#!/usr/bin/python3
import urllib.request
import json
import subprocess
"""
Small python script to download all of someone's github repos
"""
GITHUB_USERNAME=''
if __name__ == '__main__':
resp = urllib.request.urlopen('https://api.github.com/users/{}/repos'.format(GITHUB_USERNAME)).read()
json_obj = json.loads(resp.decode('utf8'))
for repo in json_obj:
s = 'https://github.com/{}/'.format(GITHUB_USERNAME)+repo['name']
subprocess.run('git clone {}'.format(s), shell=True, check=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment