Skip to content

Instantly share code, notes, and snippets.

@caniszczyk
Created October 9, 2012 04:25
Show Gist options
  • Save caniszczyk/3856584 to your computer and use it in GitHub Desktop.
Save caniszczyk/3856584 to your computer and use it in GitHub Desktop.
Clone all repos from a GitHub organization
curl -s https://api.github.com/orgs/twitter/repos?per_page=200 | ruby -rubygems -e 'require "json"; JSON.load(STDIN.read).each { |repo| %x[git clone #{repo["ssh_url"]} ]}'
@pz-max
Copy link

pz-max commented Feb 9, 2025

Here is my Linux guide using the GitHub CLI gh and ssh:
🖊️ Install GitHub CLI: https://github.com/cli/cli/blob/trunk/docs/install_linux.md#installing-gh-on-linux-and-bsd
🖊️ Clone all GitHub packages under org name: gh repo list <ADD ORG NAME> --json=sshUrl --limit 1000 -q ".[].sshUrl" | xargs -n1 git clone

Example that worked for me (for this organization repo: https://github.com/orgs/NREL-Sienna) :
gh repo list NREL-Sienna --json=sshUrl --limit 1000 -q ".[].sshUrl" | xargs -n1 git clone

@wefalltomorrow
Copy link

gh repo list theUSERorORG --json=nameWithOwner --limit 1000 -q ".[].nameWithOwner"  | %{gh repo clone $_}

This worked wonderfully, thank you!

@leah-is-offline
Copy link

leah-is-offline commented Aug 3, 2025

this can be even simpler, assuming < 100 repos: curl -s https://api.github.com/orgs/<ORG_NAME>/repos\?per_page\=100 | jq '.[].html_url' | xargs -n 1 git clone

Just in case, if you need ssh url and a bit more than 100 repos: curl -s "https://api.github.com/orgs/<ORG_NAME>/repos?per_page=100&page=<1,2...>" | jq '.[].ssh_url' | xargs -n 1 git clone

this one did what I needed in one shot for me. thanks :shipit:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment