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

后端 未结 15 1519
[愿得一人]
[愿得一人] 2020-12-23 02:02

In my GitLab repository, I have a group with 20 projects. I want to clone all projects at once. Is that possible?

15条回答
  •  盖世英雄少女心
    2020-12-23 02:52

    I built a script (curl, git, jq required) just for that. We use it and it works just fine: https://gist.github.com/JonasGroeger/1b5155e461036b557d0fb4b3307e1e75

    To find out your namespace, its best to check the API quick:

    curl "https://domain.com/api/v3/projects?private_token=$GITLAB_PRIVATE_TOKEN"
    

    There, use "namespace.name" as NAMESPACE for your group.

    The script essentially does:

    1. Get all Projects that match your PROJECT_SEARCH_PARAM
    2. Get their path and ssh_url_to_repo

      2.1. If the directory path exists, cd into it and call git pull

      2.2. If the directory path does not exist, call git clone

提交回复
热议问题