Skip to content

Instantly share code, notes, and snippets.

@bjuretko
Last active July 7, 2023 06:21
Show Gist options
  • Save bjuretko/3d73a8cee8c262bf65fdb61d9822e06e to your computer and use it in GitHub Desktop.
Save bjuretko/3d73a8cee8c262bf65fdb61d9822e06e to your computer and use it in GitHub Desktop.
Checkout all repos from an Organization/Group on GitHub / GitLab
curl -Ss -u <username> --header "X-GitHub-OTP: <OTP from your SMS or App>"  https://api.github.com/orgs/<orgname>/repos | \
jq -a -r ".[].ssh_url" | \
xargs -I "{}" git clone "{}"`
# Checkout all repositories of a gitlab group
# Project urls are stored in a project json structure under names `ssh_url_to_repo` and `http_url_to_repo`.
# You need a personal accesstoken (PAT) https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html
curl --header "Private-Token: <PAT>" https://gitlab.com/api/v4/groups/<groupname>/projects?per_page=100 | \
jq -a -M -r .[].ssh_url_to_repo | \
xargs -I "{}" git clone "{}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment