Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/lowitea/gitlobster

🦞 A tool for full cloning all available repositories from a GitLab instance.
https://github.com/lowitea/gitlobster

gitlab hacktoberfest

Last synced: 2 months ago
JSON representation

🦞 A tool for full cloning all available repositories from a GitLab instance.

Awesome Lists containing this project

README

        

# Gitlobster

**_Π˜Π½ΡΡ‚Ρ€ΡƒΠΌΠ΅Π½Ρ‚ ΠΏΠΎΠ»Π½ΠΎΠ³ΠΎ копирования всСх доступных Ρ€Π΅ΠΏΠΎΠ·ΠΈΡ‚ΠΎΡ€ΠΈΠ΅Π² с сСрвСра GitLab._**

[![Crates.io](https://img.shields.io/crates/v/gitlobster?style=for-the-badge)](https://crates.io/crates/gitlobster)
[![Docker Image Version (latest semver)](https://img.shields.io/docker/v/lowitea/gitlobster?sort=semver&label=docker&style=for-the-badge)](https://hub.docker.com/r/lowitea/gitlobster)
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/lowitea/gitlobster/integration_test.yml?branch=master&label=integration%20tests&style=for-the-badge)](https://github.com/lowitea/gitlobster/actions)
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/lowitea/gitlobster/test.yml?branch=master&label=unit%20tests&style=for-the-badge)](https://github.com/lowitea/gitlobster/actions)

[EN](README.md) | RU





## ΠšΠ»ΡŽΡ‡Π΅Π²Ρ‹Π΅ Ρ„ΡƒΠ½ΠΊΡ†ΠΈΠΈ

- ΠšΠ»ΠΎΠ½ΠΈΡ€ΠΎΠ²Π°Π½ΠΈΠ΅ всСх доступных Ρ€Π΅ΠΏΠΎΠ·ΠΈΡ‚ΠΎΡ€ΠΈΠ΅Π²
- ΠšΠ»ΠΎΠ½ΠΈΡ€ΠΎΠ²Π°Π½ΠΈΠ΅ всСх Π²Π΅Ρ‚ΠΎΠΊ ΠΊΠ°ΠΆΠ΄ΠΎΠ³ΠΎ рСпозитория
- Π—Π°Π³Ρ€ΡƒΠ·ΠΊΠ° всСх Ρ€Π΅ΠΏΠΎΠ·ΠΈΡ‚ΠΎΡ€ΠΈΠ΅Π² Π² Π΄Ρ€ΡƒΠ³ΠΎΠΉ сСрвСр GitLab (ΠΈΠ»ΠΈ Π² Π΄Ρ€ΡƒΠ³ΡƒΡŽ Π³Ρ€ΡƒΠΏΠΏΡƒ)
- ΠŸΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° скачивания Ρ‚ΠΎΠ»ΡŒΠΊΠΎ ΠΎΠ±Π½ΠΎΠ²Π»Π΅Π½ΠΈΠΉ (Π²ΠΊΠ»ΡŽΡ‡Π°Ρ скачиваниС Π½ΠΎΠ²Ρ‹Ρ… Ρ€Π΅ΠΏΠΎΠ·ΠΈΡ‚ΠΎΡ€ΠΈΠ΅Π²), послС ΠΏΠ΅Ρ€Π²ΠΎΠ³ΠΎ ΠΏΠΎΠ»Π½ΠΎΠ³ΠΎ клонирования
- Π‘ΠΎΡ…Ρ€Π°Π½Π΅Π½ΠΈΠ΅ ΠΈΠ΅Ρ€Π°Ρ€Ρ…ΠΈΠΈ Π³Ρ€ΡƒΠΏΠΏ
- ΠŸΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Ρ„ΠΈΠ»ΡŒΡ‚Ρ€ΠΎΠ² (Π² Ρ‚ΠΎΠΌ числС Π½Π° основС рСгулярных Π²Ρ‹Ρ€Π°ΠΆΠ΅Π½ΠΈΠΉ) для копирования Ρ‚ΠΎΠ»ΡŒΠΊΠΎ Π½ΡƒΠΆΠ½Ρ‹Ρ… Ρ€Π΅ΠΏΠΎΠ·ΠΈΡ‚ΠΎΡ€ΠΈΠ΅Π²

## Установка

### Docker

```shell
docker run --rm -it lowitea/gitlobster:latest --help
```

### Запуск ΠΏΡ€Π΅Π΄Π²Π°Ρ€ΠΈΡ‚Π΅Π»ΡŒΠ½ΠΎ собранных Π±ΠΈΠ½Π°Ρ€Π½Ρ‹Ρ… Ρ„Π°ΠΉΠ»ΠΎΠ²

1. Π‘ΠΊΠ°Ρ‡Π°Ρ‚ΡŒ собранный Π°Ρ€Ρ…ΠΈΠ² Π½Π° [страницС Ρ€Π΅Π»ΠΈΠ·ΠΎΠ²](https://github.com/lowitea/gitlobster/releases) ΠΏΠΎΠ΄ свою ΠΏΠ»Π°Ρ‚Ρ„ΠΎΡ€ΠΌΡƒ.
2. Π Π°ΡΠΏΠ°ΠΊΠΎΠ²Π°Ρ‚ΡŒ Π°Ρ€Ρ…ΠΈΠ².
3. Π—Π°ΠΏΡƒΡΡ‚ΠΈΡ‚ΡŒ Ρ‡Π΅Ρ€Π΅Π· консоль Ρ„Π°ΠΉΠ» `gitlobster`.

### Cargo

```shell
cargo install gitlobster
```

### Π‘Π±ΠΎΡ€ΠΊΠ° ΠΈΠ· исходников

```shell
# ΠΊΠ»ΠΎΠ½ΠΈΡ€ΠΎΠ²Π°Π½ΠΈΠ΅ рСпозитория
git clone https://github.com/lowitea/gitlobster.git
# ΠΏΠ΅Ρ€Π΅Ρ…ΠΎΠ΄ Π² ΡΠΊΠ°Ρ‡Π°Π½Π½ΡƒΡŽ Π΄ΠΈΡ€Π΅ΠΊΡ‚ΠΎΡ€ΠΈΡŽ
cd gitlobster
# сборка
cargo build --release
# запуск
./target/release/gitlobster --help
```

_Π’Π°ΠΊΠΆΠ΅ Π΅ΡΡ‚ΡŒ Π²ΠΎΠ·ΠΌΠΎΠΆΠ½ΠΎΡΡ‚ΡŒ Π·Π°ΠΏΡƒΡΡ‚ΠΈΡ‚ΡŒ Π² Ρ€Π΅ΠΆΠΈΠΌΠ΅ Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠΈ, Π±Π΅Π· ΠΏΡ€Π΅Π΄Π²Π°Ρ€ΠΈΡ‚Π΅Π»ΡŒΠ½ΠΎΠΉ сборки._

```shell
# Π² Π΄ΠΈΡ€Π΅ΠΊΡ‚ΠΎΡ€ΠΈΠΈ с ΠΏΡ€ΠΎΠ΅ΠΊΡ‚ΠΎΠΌ
cargo run -- --help
```

## ИспользованиС

### GitLab Ρ‚ΠΎΠΊΠ΅Π½

Для Ρ€Π°Π±ΠΎΡ‚Ρ‹ ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΡ‹ Π½ΡƒΠΆΠ½ΠΎ ΡΠ³Π΅Π½Π΅Ρ€ΠΈΡ€ΠΎΠ²Π°Ρ‚ΡŒ Ρ‚ΠΎΠΊΠ΅Π½ GitLab с ΠΏΡ€Π°Π²Π°ΠΌΠΈ Π½Π° Ρ‡Ρ‚Π΅Π½ΠΈΠ΅ API (`read_api`). Если Π½Π΅ ΠΈΡΠΏΠΎΠ»ΡŒΠ·ΡƒΠ΅Ρ‚ΡΡ ΠΊΠΎΠΏΠΈΡ€ΠΎΠ²Π°Π½ΠΈΠ΅ ΠΏΠΎ SSH, Ρ‚Π°ΠΊΠΆΠ΅ Π½Π΅ΠΎΠ±Ρ…ΠΎΠ΄ΠΈΠΌΡ‹ ΠΏΡ€Π°Π²Π° Π½Π° Ρ‡Ρ‚Π΅Π½ΠΈΠ΅ Ρ€Π΅ΠΏΠΎΠ·ΠΈΡ‚ΠΎΡ€ΠΈΠ΅Π² (`read_repository`).

Если Ρ€Π΅ΠΏΠΎΠ·ΠΈΡ‚ΠΎΡ€ΠΈΠΈ ΠΊΠΎΠΏΠΈΡ€ΡƒΡŽΡ‚ΡΡ Π²ΠΎ Π²Ρ‚ΠΎΡ€ΠΎΠΉ GitLab, Ρ‚ΠΎ Ρ‚ΠΎΠΊΠ΅Π½ Π½ΡƒΠΆΠ΅Π½ Ρ‚Π°ΠΊΠΆΠ΅ ΠΈ для Π½Π΅Π³ΠΎ. НСобходимы ΠΏΠΎΠ»Π½Ρ‹Π΅ ΠΏΡ€Π°Π²Π° Π½Π° API (`api`). Если Π½Π΅ ΠΈΡΠΏΠΎΠ»ΡŒΠ·ΡƒΠ΅Ρ‚ΡΡ Π·Π°Π³Ρ€ΡƒΠ·ΠΊΠ° ΠΏΠΎ SSH, Ρ‚Π°ΠΊΠΆΠ΅ Π½Π΅ΠΎΠ±Ρ…ΠΎΠ΄ΠΈΠΌΡ‹ ΠΏΡ€Π°Π²Π° Π½Π° запись Ρ€Π΅ΠΏΠΎΠ·ΠΈΡ‚ΠΎΡ€ΠΈΠ΅Π² (`write_repository`).

Π‘Π³Π΅Π½Π΅Ρ€ΠΈΡ€ΠΎΠ²Π°Ρ‚ΡŒ Ρ‚ΠΎΠΊΠ΅Π½Ρ‹ ΠΌΠΎΠΆΠ½ΠΎ Π½Π° [страницС настроСк](https://gitlab.com/-/profile/personal_access_tokens).

### SSH

Если ΠΈΡΠΏΠΎΠ»ΡŒΠ·ΡƒΠ΅Ρ‚ΡΡ ΠΊΠΎΠΏΠΈΡ€ΠΎΠ²Π°Π½ΠΈΠ΅ Ρ‡Π΅Ρ€Π΅Π· SSH, Ρ‚ΠΎΠ³Π΄Π° ssh-ΠΊΠ»ΡŽΡ‡ΠΈ Π΄ΠΎΠ»ΠΆΠ½Ρ‹ Π±Ρ‹Ρ‚ΡŒ [Π΄ΠΎΠ±Π°Π²Π»Π΅Π½Ρ‹](https://gitlab.com/-/profile/keys) Π² GitLab.

### ΠšΠΎΠΏΠΈΡ€ΠΎΠ²Π°Π½ΠΈΠ΅ всСх Ρ€Π΅ΠΏΠΎΠ·ΠΈΡ‚ΠΎΡ€ΠΈΠ΅Π² Π² Π΄Ρ€ΡƒΠ³ΠΎΠΉ GitLab

```shell
gitlobster \
--ft= \
--fu=https://gitlab.com/ \
--bt= \
--bu=https://gitlab.com/ \
--bg=gitlobster_test/upload
```

### Π‘ΠΊΠ°Ρ‡ΠΈΠ²Π°Π½ΠΈΠ΅ всСх Ρ€Π΅ΠΏΠΎΠ·ΠΈΡ‚ΠΎΡ€ΠΈΠ΅Π² Π² Π»ΠΎΠΊΠ°Π»ΡŒΠ½ΡƒΡŽ ΠΏΠ°ΠΏΠΊΡƒ

```shell
gitlobster \
--ft= \
--fu=https://gitlab.com/ \
-d out_directory
```

_ΠŸΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΈΠ²Π°Π΅Ρ‚ΡΡ ΠΎΠ΄Π½ΠΎΠ²Ρ€Π΅ΠΌΠ΅Π½Π½ΠΎΠ΅ сохранСниС Ρ€Π΅ΠΏΠΎΠ·ΠΈΡ‚ΠΎΡ€ΠΈΠ΅Π² локально ΠΈ ΠΊΠΎΠΏΠΈΡ€ΠΎΠ²Π°Π½ΠΈΠ΅ Π²ΠΎ Π²Ρ‚ΠΎΡ€ΠΎΠΉ GitLab._

### ИспользованиС Ρ„ΠΈΠ»ΡŒΡ‚Ρ€ΠΎΠ² ΠΈ Ρ„ΠΈΠ»ΡŒΡ‚Ρ€ΡƒΡŽΡ‰ΠΈΡ… Ρ„Π»Π°Π³ΠΎΠ²

```shell
gitlobster \
--ft= \
--fu=https://gitlab.com/ \
--only-owned \
--include="^gitlobster_test/download/project_2" \
--include="^gitlobster_test/download/project_1" \
-d out_directory
```

_Π’Π°ΠΊΠΆΠ΅ поддСрТиваСтся Ρ„Π»Π°Π³ `--exclude` для скачивания всСх Ρ€Π΅ΠΏΠΎΠ·ΠΈΡ‚ΠΎΡ€ΠΈΠ΅Π², ΠΊΡ€ΠΎΠΌΠ΅ Ρ‚Π΅Ρ…, Ρ‡Ρ‚ΠΎ ΠΏΠΎΠ΄ΠΏΠ°Π΄Π°ΡŽΡ‚ ΠΏΠΎΠ΄ шаблон._

_МоТно ΠΈΡΠΏΠΎΠ»ΡŒΠ·ΠΎΠ²Π°Ρ‚ΡŒ Ρ‚ΠΎΠ»ΡŒΠΊΠΎ ΠΎΠ΄ΠΈΠ½ ΠΈΠ· Ρ„Π»Π°Π³ΠΎΠ² `--exclude` ΠΈΠ»ΠΈ `--include`. ΠŸΡ€ΠΈ ΠΎΠ΄Π½ΠΎΠ²Ρ€Π΅ΠΌΠ΅Π½Π½ΠΎΠΌ использовании этих Ρ„Π»Π°Π³ΠΎΠ² Π±ΡƒΠ΄Π΅Ρ‚ Π²Ρ‹Π΄Π°Π½Π° ΡΠΎΠΎΡ‚Π²Π΅Ρ‚ΡΡ‚Π²ΡƒΡŽΡ‰Π°Ρ ошибка._

### ИспользованиС Ρ‡Π΅Ρ€Π΅Π· Π΄ΠΎΠΊΠ΅Ρ€

```shell
docker run --rm -it -v $(pwd)/out:/out lowitea/gitlobster:latest \
--ft= \
--fu=https://gitlab.com/ \
--include='^gitlobster_test/example' \
-d /out
```

### Π’Ρ‹Π·ΠΎΠ² help

```text
$ gitlobster --help

A tool for cloning all available repositories in a GitLab instance

Usage: gitlobster [OPTIONS] --fu --ft

Options:
--fu
The GitLab instance URL for fetch repositories (example: https://gitlab.local/) [env: GTLBSTR_FETCH_URL=]
--ft
Your personal GitLab token for fetch repositories [env: GTLBSTR_FETCH_TOKEN=]
--bu
The GitLab instance URL for backup repositories (example: https://backup-gitlab.local/) [env: GTLBSTR_BACKUP_URL=]
--bt
Your personal GitLab token for backup repositories [env: GTLBSTR_BACKUP_TOKEN=]
--bg
A target created group on backup GitLab for push repositories [env: GTLBSTR_BACKUP_GROUP=]
-i, --include
Include regexp patterns (cannot be used together with --exclude flag, may be repeated) [env: GTLBSTR_INCLUDE=]
-x, --exclude
Comma separated exclude regexp patterns (cannot be used together with --include flag, may be repeated) [env: GTLBSTR_EXCLUDE=]
-d, --dst
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
Low-level option, how many projects can fetch in one request [env: GTLBSTR_OBJECTS_PER_PAGE=]
--limit
Maximum projects to download [env: GTLBSTR_LIMIT=]
--concurrency-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
Timeout for requests to GitLab instances in seconds [env: GTLBSTR_GITLAB_TIMEOUT=]
-h, --help
Print help
-V, --version
Print version
```

### ΠŸΡ€Π΅Π΄ΡƒΠΏΡ€Π΅ΠΆΠ΄Π΅Π½ΠΈΠ΅

ΠŸΡƒΡΡ‚Ρ‹Π΅ ΠΏΡ€ΠΎΠ΅ΠΊΡ‚Ρ‹ Π½Π΅ Π±ΡƒΠ΄ΡƒΡ‚ пСрСнСсСны. Π’Π°ΠΊ ΠΊΠ°ΠΊ, ΠΈΡ… Π½Π΅Π²ΠΎΠ·ΠΌΠΎΠΆΠ½ΠΎ ΡΠΊΠ»ΠΎΠ½ΠΈΡ€ΠΎΠ²Π°Ρ‚ΡŒ Ρ‡Π΅Ρ€Π΅Π· git, ΠΏΠΎΠΊΠ° Π² этих ΠΏΡ€ΠΎΠ΅ΠΊΡ‚Π°Ρ… Π½Π΅ Π±ΡƒΠ΄Π΅Ρ‚ создано Π½ΠΈ ΠΎΠ΄Π½ΠΎΠΉ Π²Π΅Ρ‚ΠΊΠΈ ([issue 37](https://github.com/lowitea/gitlobster/issues/37)).

## Аналоги

- [gitlabber](https://github.com/ezbz/gitlabber)
- [ghorg](https://github.com/gabrie30/ghorg)