Skip to content

Instantly share code, notes, and snippets.

@justanotherdot
Last active January 28, 2021 02:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save justanotherdot/d205322999a44f997cdc6550b065c6ef to your computer and use it in GitHub Desktop.
Save justanotherdot/d205322999a44f997cdc6550b065c6ef to your computer and use it in GitHub Desktop.
Clone all repos for an org via the gh tool.
: {org:?"need to set an org name"}
: {max_pages:?"need to set maximum number of pages"}
for PAGE in $( seq $max_pages ); do
gh api ‘orgs/$org/repos?per_page=100&page=‘“$PAGE” | jq -r ‘map(.name) | .[]' | while read NAME; do
git clone “git@github.com:$org/$NAME”
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment