Gitlab Mirror will watch a GitLab group and keep it in sync with external git repositories.
- Create group on your gitlab instance or gitlab.com. e.g.
mirror-test
- Add a repository you like to sync to. e.g
my-project
- Add a description to the project in YAML format containing an
origin
field. e.g.origin: https://git.example.org/my-project.git
- Execute set the
GITLAB_PRIVATE_TOKEN
environment variable a personal access token or your private token and executegit-mirror
export GITLAB_PRIVATE_TOKEN="<personal-access-token>"
git-mirror -g mirror-test
This will sync the group mirror-test
on gitlab.com. If you want to sync a group on a different GitLab instance, use the -u
flag.
git-mirror -g mirror-test -u http://gitlab.example.org
git-mirror
allows to execute multiple mirror jobs in parallel using the -c <n>
flag.
git-mirror -g mirror-test -c 8
This will execute at most 8 sync jobs in parallel
For git-mirror
to mirror a repository it needs to know where to sync from.
In order to achive this git-mirror
expects the description field of a mirrored project to
be valid YAML with at least an origin
field.
origin: https://git.example.org/my-project.git
A list of currently supported fields
origin
Source repository to mirror fromskip
Temporarily exclude a project from syncing by addingskip: true
destination
Reserved for future use
Any other fields are ignored
There is also a docker image available. It can be used as follows:
docker run -e GITLAB_PRIVATE_TOKEN="x" bachp/git-mirror git-mirror -g mirror -u http://gitlab.example.com
In order to build this project you need a least rust v1.18.0. The easiest way to get rust is via: rustup.rs
The project can be built using cargo
cargo build
This project is licensed under the MIT License - see the LICENSE file for details