Skip to content

Instantly share code, notes, and snippets.

@rossille
Created November 22, 2016 12:34
Show Gist options
  • Save rossille/6b177a9f87d8aeda43e548c78908950b to your computer and use it in GitHub Desktop.
Save rossille/6b177a9f87d8aeda43e548c78908950b to your computer and use it in GitHub Desktop.
Clone all organisations repositories with: ./clone.sh <git user> <git password> <org>
#!/usr/bin/env bash
curl -u $1:$2 -s "https://api.github.com/orgs/$3/repos?per_page=50&page=1" | ruby -rubygems -e 'require "json"; JSON.load(STDIN.read).each { |repo| %x[git clone #{repo["ssh_url"]} ]}'
curl -u $1:$2 -s "https://api.github.com/orgs/$3/repos?per_page=50&page=2" | ruby -rubygems -e 'require "json"; JSON.load(STDIN.read).each { |repo| %x[git clone #{repo["ssh_url"]} ]}'
curl -u $1:$2 -s "https://api.github.com/orgs/$3/repos?per_page=50&page=3" | ruby -rubygems -e 'require "json"; JSON.load(STDIN.read).each { |repo| %x[git clone #{repo["ssh_url"]} ]}'
curl -u $1:$2 -s "https://api.github.com/orgs/$3/repos?per_page=50&page=4" | ruby -rubygems -e 'require "json"; JSON.load(STDIN.read).each { |repo| %x[git clone #{repo["ssh_url"]} ]}'
# add pages if you have more than 200 repos
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment