代码拉取完成,页面将自动刷新
Gitlabber clones or pulls all projects under a subset of groups / subgroups by building a tree from the Gitlab API and allowing you to specify which subset of the tree you want to clone using glob patterns and/or regex expressions.
pip install gitlabber
Argument |
Flag |
Environment Variable |
---|---|---|
token |
-t |
GITLAB_TOKEN |
url |
-u |
GITLAB_URL |
method |
-m |
GITLABBER_CLONE_METHOD |
naming |
-n |
GITLABBER_FOLDER_NAMING |
include |
-i |
GITLABBER_INCLUDE |
exclude |
-x |
GITLABBER_EXCLUDE |
To view the tree run the command with your includes/excludes and the -p flag it will print your tree like so
root [http://gitlab.my.com]
├── group1 [/group1]
│ └── subgroup1 [/group1/subgroup1]
│ └── project1 [/group1/subgroup1/project1]
└── group2 [/group2]
├── subgroup1 [/group2/subgroup1]
│ └── project2 [/group2/subgroup1/project2]
├── subgroup2 [/group2/subgroup2]
└── subgroup3 [/group2/subgroup3]
usage: gitlabber [-h] [-t token] [-u url] [--verbose] [-p]
[--print-format {json,yaml,tree}] [-m {ssh,https}] [-i csv]
[-x csv] [--version]
[dest]
Gitlabber - clones or pulls entire groups/projects tree from gitlab
positional arguments:
dest destination path for the cloned tree (created if doesn't exist)
optional arguments:
-h, --help show this help message and exit
-t token, --token token
gitlab personal access token https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html
-u url, --url url base gitlab url (e.g.: 'http://gitlab.mycompany.com')
--verbose print more verbose output
-p, --print print the tree without cloning
--print-format {json,yaml,tree}
print format (default: 'tree')
-n {name,path}, --naming {name,path}
the folder naming strategy for projects (default: "name")
-m {ssh,http}, --method {ssh,http}
the git transport method to use for cloning (default: "ssh")
-a {include,exclude,only}, --archived {include,exclude,only}
include archived projects and groups in the results (default: "include")
-i csv, --include csv
comma delimited list of glob patterns of paths to projects or groups to clone/pull
-x csv, --exclude csv
comma delimited list of glob patterns of paths to projects or groups to exclude from clone/pull
-r, --recursive clone/pull git submodules recursively
--version print the version
examples:
clone an entire gitlab tree using a base url and a token:
gitlabber -t <personal access token> -u <gitlab url> .
# the following examples assume you provided token/url in environment variables so these arguments are omitted
only print the gitlab tree:
gitlabber -p .
clone only projects under subgroup 'MySubGroup' to location '~/GitlabRoot':
gitlabber -i '/MyGroup/MySubGroup**' ~/GitlabRoot
clone only projects under group 'MyGroup' excluding any projects under subgroup 'MySubGroup':
gitlabber -i '/MyGroup**' -x '/MyGroup/MySubGroup**' .
clone an entire gitlab tree except projects under groups named 'ArchiveGroup':
gitlabber -x '/ArchiveGroup**' .
clone projects that start with a case insensitive 'w' using a regular expression:
gitlabber -i '/{[w].*}' .
export GIT_PYTHON_TRACE='full'
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。