Skip to content

Instantly share code, notes, and snippets.

@ngsankha
Last active December 20, 2015 03:39
Show Gist options
  • Save ngsankha/6064731 to your computer and use it in GitHub Desktop.
Save ngsankha/6064731 to your computer and use it in GitHub Desktop.
Clones all your original repositories at once.
#!/usr/bin/python
import sys, httplib, json, subprocess
con = httplib.HTTPSConnection("api.github.com")
def cloneRepos(user):
request = "/users/" + user + "/repos"
con.request("GET", request)
obj = json.load(con.getresponse())
for repo in obj:
if(not repo['fork']):
subprocess.call(["git", "clone", repo['clone_url']])
if len(sys.argv) > 1:
user = sys.argv[1]
cloneRepos(user)
else:
print("Usage: clone username")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment