10个稳定版本
1.4.3 | 2024年4月21日 |
---|---|
1.4.2 | 2023年11月25日 |
1.4.0 | 2023年10月8日 |
1.3.1 | 2023年2月21日 |
0.0.1 |
|
#54 在 开发工具 类别中
89 每月下载量
71KB
911 行
Gitlobster
用于从GitLab服务器完整克隆所有可用仓库的工具。
英文 | 俄文
主要功能
- 克隆所有可用仓库
- 克隆每个仓库的所有分支
- 将所有仓库上传到另一个GitLab服务器(或同一GitLab中的组)
- 仅下载更新(包括所有新添加的仓库)
- 保留组层次结构
- 支持过滤(包括正则表达式模板)以仅克隆必要的仓库
安装
Docker
docker run --rm -it lowitea/gitlobster:latest --help
运行预编译的二进制文件
- 从发布页面下载适用于您的操作系统的存档。
- 解压缩存档。
- 运行
gitlobster
文件。
Cargo
cargo install gitlobster
从源代码构建
# clone the repository
git clone https://github.com/lowitea/gitlobster.git
# going to the downloaded directory
cd gitlobster
# build
cargo build --release
# run
./target/release/gitlobster --help
还可以选择在开发者模式下运行,无需预构建。
# in the project directory
cargo run -- --help
用法
GitLab令牌
为了使该工具能够工作,您需要生成具有API读取权限的GitLab令牌(read_api
)。如果不使用SSH复制,则还需要读取仓库的权限(read_repository
)。
如果使用第二个GitLab来复制仓库,则也需要该GitLab的令牌。需要完全API权限(api
)。如果不使用SSH上传,则还需要仓库的写入权限(write_repository
)。
您可以在设置页面上生成令牌。
SSH
如果使用SSH复制,则必须在GitLab中添加ssh密钥。
将所有仓库复制到第二个GitLab
gitlobster \
--ft=<FETCH_TOKEN> \
--fu=https://gitlab.com/ \
--bt=<UPLOAD_TOKEN> \
--bu=https://gitlab.com/ \
--bg=gitlobster_test/upload
将所有仓库下载到本地目录
gitlobster \
--ft=<FETCH_TOKEN> \
--fu=https://gitlab.com/ \
-d out_directory
同时将仓库保存到本地目录和第二个GitLab是支持的。
使用过滤器及过滤标志
gitlobster \
--ft=<FETCH_TOKEN> \
--fu=https://gitlab.com/ \
--only-owned \
--include="^gitlobster_test/download/project_2" \
--include="^gitlobster_test/download/project_1" \
-d out_directory
还可以使用 --exclude
标志来加载除匹配特定模板的存储库之外的所有存储库。
同时使用 --exclude
和 --include
标志是不允许的。
与Docker一起使用
docker run --rm -it -v $(pwd)/out:/out lowitea/gitlobster:latest \
--ft=<FETCH_TOKEN> \
--fu=https://gitlab.com/ \
--include='^gitlobster_test/example' \
-d /out
帮助命令
$ gitlobster --help
A tool for cloning all available repositories in a GitLab instance
Usage: gitlobster [OPTIONS] --fu <FETCH URL> --ft <FETCH TOKEN>
Options:
--fu <FETCH URL>
The GitLab instance URL for fetch repositories (example: https://gitlab.local/) [env: GTLBSTR_FETCH_URL=]
--ft <FETCH TOKEN>
Your personal GitLab token for fetch repositories [env: GTLBSTR_FETCH_TOKEN=]
--bu <BACKUP URL>
The GitLab instance URL for backup repositories (example: https://backup-gitlab.local/) [env: GTLBSTR_BACKUP_URL=]
--bt <BACKUP TOKEN>
Your personal GitLab token for backup repositories [env: GTLBSTR_BACKUP_TOKEN=]
--bg <BACKUP GROUP>
A target created group on backup GitLab for push repositories [env: GTLBSTR_BACKUP_GROUP=]
-i, --include <PATTERN>
Include regexp patterns (cannot be used together with --exclude flag, may be repeated) [env: GTLBSTR_INCLUDE=]
-x, --exclude <PATTERN>
Comma separated exclude regexp patterns (cannot be used together with --include flag, may be repeated) [env: GTLBSTR_EXCLUDE=]
-d, --dst <DIRECTORY>
A destination local folder for save downloaded repositories [env: GTLBSTR_DST=]
-v, --verbose...
Verbose level (one or more, max four)
--dry-run
Show all projects to download
--objects-per-page <COUNT>
Low-level option, how many projects can fetch in one request [env: GTLBSTR_OBJECTS_PER_PAGE=]
--limit <COUNT>
Maximum projects to download [env: GTLBSTR_LIMIT=]
--concurrency-limit <LIMIT>
Limit concurrency download [env: GTLBSTR_CONCURRENCY_LIMIT=] [default: 21]
--only-owned
Download projects explicitly owned by user [env: GTLBSTR_ONLY_OWNED=]
--only-membership
Download only user's projects [env: GTLBSTR_ONLY_MEMBERSHIP=]
--download-ssh
Enable download by ssh instead of http. An authorized ssh key is required [env: GTLBSTR_DOWNLOAD_SSH=]
--upload-ssh
Enable upload by ssh instead of http. An authorized ssh key is required [env: GTLBSTR_UPLOAD_SSH=]
--download-force-http
Force download repositories by insecure protocol. Does not work with the download_ssh flag [env: GTLBSTR_DOWNLOAD_FORCE_HTTP=]
--download-force-https
Force download repositories by secure protocol. Does not work with the download_ssh flag [env: GTLBSTR_DOWNLOAD_FORCE_HTTPS=]
--upload-force-http
Force upload repositories by insecure protocol. Does not work with the upload_ssh flag [env: GTLBSTR_UPLOAD_FORCE_HTTP=]
--upload-force-https
Force upload repositories by secure protocol. Does not work with the upload_ssh flag [env: GTLBSTR_UPLOAD_FORCE_HTTPS=]
--disable-hierarchy
Disable saving the directory hierarchy [env: GTLBSTR_DISABLE_HIERARCHY=]
--clear-dst
Clear dst path before cloning [env: GTLBSTR_CLEAR_DST=]
--only-master
Download only default branch [env: GTLBSTR_ONLY_MASTER=]
--disable-sync-date
Disable adding sync dates in project descriptions [env: GTLBSTR_DISABLE_SYNC_DATE=]
--gitlab-timeout <GITLAB_TIMEOUT>
Timeout for requests to GitLab instances in seconds [env: GTLBSTR_GITLAB_TIMEOUT=]
-h, --help
Print help
-V, --version
Print version
注意
空项目将不会被迁移。因为这些项目在创建分支之前无法通过git克隆(问题编号37)。
类似物
依赖关系
~12–25MB
~365K SLoC