Created
October 9, 2012 04:25
-
-
Save caniszczyk/3856584 to your computer and use it in GitHub Desktop.
Clone all repos from a GitHub organization
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"]} ]}' |
I just want to say that this thread is a great example of the open source community. An 8-year thread on a platform, with everybody posting little bits of code and share with others for free, on the platform itself.
I agree.
To clone all repos from an organisation using HTTP
gh auth login
gh repo list <organisation> --json=url --limit 1000 -q ".[].url" | xargs -n1 git clone
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@Vaisakhkm2625,
If you don't want to use SSH protocol, just run this command1:
It's interactive, so there are a couple of selections you need to make first i.e., selecting the host (GitHub or GitHub Enterprise) etc. but eventually you will reach:
Select ssh, and it
gh
will save your preference for futuregh
commands. I'd recommend doing it this way so thatgh
can manage your credentials, BUT you can probably skip all the above by running2:gh config set git_protocol ssh
"
gh config set git_protocol
" (see diff below).sshhttpDoy! 😄
Footnotes
gh auth login
(cli.github.com/manual) ↩gh config set
(cli.github.com/manual) ↩