Crates.io | gitlobster |
lib.rs | gitlobster |
version | 1.4.3 |
source | src |
created_at | 2022-12-04 18:50:54.213811 |
updated_at | 2024-04-21 15:47:39.961113 |
description | A tool for cloning all available repositories in a GitLab instance |
homepage | https://github.com/lowitea/gitlobster |
repository | https://github.com/lowitea/gitlobster |
max_upload_size | |
id | 729699 |
size | 167,465 |
A tool for full cloning all available repositories from a GitLab server.
EN | RU
docker run --rm -it lowitea/gitlobster:latest --help
gitlobster
file.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
The option to run it in the developer mode without pre-build is also available.
# in the project directory
cargo run -- --help
In order for the tool to work, you need to generate a GitLab token with API read rights (read_api
). If SSH copying is not used, then you will also need a permission to read repositories (read_repository
).
If a second GitLab is used to copy repositories there, then a token is also required for it. Full API rights are required (api
). If SSH upload is not used, then you will also need write permissions for repositories (write_repository
).
You can generate tokens on the settings page.
If SSH copying is used, then ssh keys must be added in 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
Simultaneous saving repositories to a local directory and a second GitLab is supported.
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
It's also possible to use --exclude
flag to load all repositories except repositories matching a necessary template.
Simultaneous use of both --exclude
and --include
flags isn't allowed.
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
Empty projects will not be migrated. Because they cannot be cloned via git until no branches are created in these projects (issue 37).