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

Doon picture Doon · Mar 17, 2015 · Viewed 67.2k times · Source

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

Answer

VonC picture VonC · Mar 17, 2015

Not really, unless:

  • you have a 21st project which references the other 20 as submodules.
    (in which case a clone followed by a git submodule update --init would be enough to get all 20 projects cloned and checked out)

  • or you somehow list the projects you have access (GitLab API for projects), and loop on that result to clone each one (meaning that can be scripted, and then executed as "one" command)


Since 2015, Jay Gabez mentions in the comments (August 2019) the tool gabrie30/ghorg

ghorg allows you to quickly clone all of an org's or user's repos into a single directory.

Usage:

$ ghorg clone someorg
$ ghorg clone someuser --clone-type=user --protocol=ssh --branch=develop
$ ghorg clone gitlab-org --scm=gitlab --namespace=gitlab-org/security-products
$ ghorg clone --help

Also (2020): https://github.com/ezbz/gitlabber

usage: gitlabber [-h] [-t token] [-u url] [--debug] [-p]
                [--print-format {json,yaml,tree}] [-i csv] [-x csv]
                [--version]
                [dest]

Gitlabber - clones or pulls entire groups/projects tree from gitlab