Clone all GitHub repositories in an organization

Carlos Buenosvinos
Rigor Guild
Published in
Jul 26, 2022

For reviewing easily all the Qualifyze code, I wanted to clone all the GitHub repositories in the Qualifyze organization. Easy task, worthy to share.

Requirements

  1. GitHub Personal Access Token that you can get from https://github.com/settings/tokens (click on “generate a new one” and check all the “repo” and “user” permission scopes)
  2. jq (https://stedolan.github.io/jq/) is a lightweight and flexible command-line JSON processor that you can install via homebrew easily using “brew install jq”
  3. and a Terminal

Once you are in the folder you want to clone all the repositories (one new subfolder per repository) just type:

curl -s -H “Authorization: token $YOUR_TOKEN” \
“https://api.github.com/orgs/$YOUR_ORG/repos?per_page=100"\
| jq -r “.[].clone_url”\
| xargs -L1 git clone

--

--

Carlos Buenosvinos
Rigor Guild

XP, Scrum, Agile, Lean, DevOps, Management 3.0, DDD, Microservices, Testing, Tech Management & PHP. More info on https://blog.carlosbuenosvinos.com