Skip to content

Python script to clone all GitLab projects of a group and their subgroups while keeping the tree structure.

License

Notifications You must be signed in to change notification settings

pauloeli/gitlab-clone-group

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

gitlab-clone-group

Based on adroste/gitlab-clone-group

Python

Python script to clone all GitLab projects of a group keeping the tree structure. Tested with GitLab API v4.

I found problems in some structures, where list generated by groups don't show some projects (I don't know why). So, I get all projects which user have permission and make a filter. It's not so performative, but I get all I want.

Python isn't my first language, so make comfortable to improve or submit changes.

Usage

  1. Download the gitlab-clone-group.py
  2. Generate a private access token with read_api and read_repository rights
  3. Specify the "root" name of group. (after gitlab.com)
  4. Run the script

Example:

python3 gitlab-clone-group.py --token glabc-XXX "personal/services" .

Help:

usage: gitlab-clone-group.py [-h] [--token TOKEN] [--gitlab-domain GITLAB_DOMAIN] [--dump TRUE] [--dump-file projects.txt] group directory

positional arguments:
  group                 group path (piece)
  directory             directory to clone repos into

options:
  -h, --help            show this help message and exit
  --token TOKEN         gitlab private access token with read_api and read_repository rights
  --gitlab-domain       domain of Gitlab instance to use, defaults to: gitlab.com
  --dump                if you want to dump all items in a text file list
  --dump-file           file location to dump items

About

Python script to clone all GitLab projects of a group and their subgroups while keeping the tree structure.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages