DEV Community

Greg Bulmash 🥑
Greg Bulmash 🥑

Posted on • Originally published at yiddish.ninja on

Clone ALL Github repos for a user on Windows

Recently I had to do this, found a shell script that cloned all repositories matching a search query, and edited it to meet my purposes.

You’ll need

  1. A working installation of Git with GitBash.
  2. A copy of jq in a directory that’s in your path (or in the directory where you’re running the script)
  3. Git set up to work with SSH. Alternatively, you might want to try changing “ssh_url” below to “clone_url” and that should pull the https link.
  4. An approximate count of the number of repos you’ll be cloning. Set the end of the loop in the first line to that number divided by 100, rounded up to the next whole number. For example, I had a little over 100 public repos to clone, so my loop is 1..2.

The Script

for i in {1..2}
  do curl "https://api.github.com/users/[your user name]/repos?per\_page=100&page=$i" \ | jq -r '.[].ssh\_url' >> urls.txtdonecat urls.txt | xargs -P8 -L1 git clone
Enter fullscreen mode Exit fullscreen mode

Then just run the script in GitBash. sh [scriptname]

And that did it for me. Hope it helps.

AWS GenAI LIVE image

Real challenges. Real solutions. Real talk.

From technical discussions to philosophical debates, AWS and AWS Partners examine the impact and evolution of gen AI.

Learn more

Top comments (1)

Collapse
 
letmypeoplecode profile image
Greg Bulmash 🥑

FYI, I have so many repos because I had to mass fork a bunch of repos for work to do some batch operations, then mass commit, push, and submit pull requests.

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay