Skip to content

Instantly share code, notes, and snippets.

@jharjono
Created August 20, 2011 15:31
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jharjono/1159239 to your computer and use it in GitHub Desktop.
Save jharjono/1159239 to your computer and use it in GitHub Desktop.
Python script to clone all watched repos that a user is watching on Github
#!/usr/bin/env python
# Script to clone all the github repos that a user is watching
import requests
import json
import subprocess
# Grab all the URLs of the watched repo
user = 'jharjono'
r = requests.get("http://github.com/api/v2/json/repos/watched/%s" % (user))
repos = json.loads(r.content)
urls = [repo['url'] for repo in repos['repositories']]
# Clone them all
for url in urls:
cmd = 'git clone ' + url
pipe = subprocess.Popen(cmd, shell=True)
pipe.wait()
print "Finished cloning %d watched repos!" % (len(urls))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment