How to clone all projects of a group at once in GitLab?

One liner with curl, jq, tr:

for repo in $(curl -s --header "PRIVATE-TOKEN: your_private_token" https://<your-host>/api/v4/groups/<group_id> | jq -r ".projects[].ssh_url_to_repo"); do git clone $repo; done;

For Gitlab.com use https://gitlab.com/api/v4/groups/<group_id>

To include subgroups add include_subgroups=true query param like

https://<your-host>/api/v4/groups/<group_id>?include_subgroups=true

Note: To clone with http url use http_url_to_repo instead of ssh_url_to_repo in jq (Thanks @MattVon for the comment)

Leave a Comment