Skip to content

Instantly share code, notes, and snippets.

@sarajmunjal
Created July 30, 2015 21:01
Show Gist options
  • Save sarajmunjal/c0e49a50378dac83663b to your computer and use it in GitHub Desktop.
Save sarajmunjal/c0e49a50378dac83663b to your computer and use it in GitHub Desktop.
Helps to clone all repos in your organisation. Useful for setting up, or maybe backing up the universe on your last day at work :) Insert values for organisation, username, password.
import requests
import requests_oauthlib
import os
from requests_oauthlib import OAuth1
organisation = "<org_name>"
username = "<username>"
password = "<your_password>"
url = "https://api.github.com/orgs/" + organisation + "/repos"
auth = (username,password)
r = requests.get(url,auth=auth)
res = r.json()
for obj in res:
clone_url = obj.get('clone_url');
print "Now cloning " + clone_url
os.system("git clone "+clone_url);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment