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

后端 未结 15 1427
[愿得一人]
[愿得一人] 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 03:03

    If you are okay with some shell sorecery this will clone all the repos grouped by their group-id (you need jq and parallel)

    seq 3                                                                           \
    | parallel curl -s "'https://[gitlabUrl]/api/v4/projects?page={}&per_page=100&private_token=[privateToken]'
                         | jq '.[] | .ssh_url_to_repo, .name, .namespace.path'" \
    | tr -d '"'                                                                 \
    | awk '{ printf "%s ", $0; if (NR % 3 == 0) print " " }'                    \
    | parallel --colsep ' ' 'mkdir -p {2} && git clone {1} {3}/{2}'
    

提交回复
热议问题