Clone all repository hosted on Gitlab

less than 1 minute read

Published:

Gitlab APIs

We will use personal access token with projects API to get projects info.

Usage

for repo in $(curl -H "PRIVATE-TOKEN: <ACCESS-TOKEN>" "http://<HOST-NAME>/api/v4/projects?membership=true&page=1&per_page=100" | jq '.[].ssh_url_to_repo' | tr -d '"'); do git clone $repo; done;

There is another tool is Glab

Github APIs

Get user repositories APIs

Usage

curl -s -H "Authorization: token <ACCESS-TOKEN>" "https://api.github.com/users/<USER-NAME>/repos?per_page=100" | jq -r '.[].ssh_url' | xargs -L1 git clone

Thank for reading :blush:.