bachp/git-mirror
bachp/git-mirror has 171 GitHub stars and 29 forks. GitHot measured 0 stars in 24 hours and 0 in 7 days. Last checked 2026-11-24 07:45 UTC. Last push 2026-11-09.
Crecimiento de estrellas medido
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- Recopilando historial
- in 1 month
- Recopilando historial
Cambios netos en períodos que se solapan, no totales diarios. Los datos no disponibles se dejan en blanco. Las estrellas indican interés, no calidad.
Acerca de
A small utility that allows mirroring external repositories to GitLab, GitHub and possibly more.
Herramientas de desarrolloREADME.md
OriginalGit Mirror
Git Mirror will watch a GitLab or GitHub groups and keep it in sync with external git repositories.
Usage
Install git and git-lfs.
- 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
originfield. e.g.origin: https://git.example.org/my-project.git - Execute set the
PRIVATE_TOKENenvironment variable a personal access token or your private token and executegit-mirror
export 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
Multiple concurrent jobs
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
Skipping the mirror directory lock
By default, git-mirror creates and locks git-mirror.lock in the mirror directory to prevent concurrent runs against the same directory. Use --no-lock to skip creating or acquiring this lock:
git-mirror -g mirror-test --no-lock
Only use this when concurrent access to the mirror directory is safe for your setup.
Setting a timeout for Git operations
git-mirror allows to set a timeout for underlying git invocations. This can be controlled via the --git-timeout <timeout_seconds> flag.
git-mirror -g mirror-test --git-timeout 120
This will limit any git invocation to 120 seconds. If a git command reaches this threshold, the repository will be aborted and the next job in line will be taken up by the worker.
Description format
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
originSource repository to mirror fromskipTemporarily exclude a project from syncing by addingskip: truedestinationReserved for future uselfsDisable git lfs mirror for a specific repo withlfs: false(default istrue), only relevant if git-mirror is started with--lfsrefspecPush only refspec. Add the refspec list to use it. Any valid refspec is possible. E.g.refspec: ["master", "2.0", "+refs/tags/*:refs/tags/*"]See also https://git-scm.com/book/en/v2/Git-Internals-The-Refspec
Note: If set, this field would override the default (global) refspec from the command line option
--refspec, if specified. Multiple refs can be set by repeating the option.
Any other fields are ignored
Mirror to GitHub
git-mirror also supports mirroring to GitHub.
This can be done by specifying GitHub as provider:
export PRIVATE_TOKEN="<personal-access-token>"
git-mirror -g mirror-test -p GitHub
This has been tested against github.com but it might also work with on premise installations of GitHub.
Container
There is also a container image available. It can be used with docker or podman as follows:
docker run -e PRIVATE_TOKEN="x" ghcr.io/bachp/git-mirror git-mirror -g mirror -u http://gitlab.example.com
Building & Installing
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
They're using Git Mirror
- gitlab-mirror-orchestrator tool at OW2 Consortium.
License
This project is licensed under the MIT License - see the LICENSE file for details
Explorar proyectos relacionados
Cargando…