La versión Gitlab Enterpise Edition tiene una funcionalidad ''mirror'', pero en la versión Community esa funcionalidad no está disponible.
Esta es una posible solución que utiliza git nativo por lo que se adapta a cualquier repo/servicio.
$ git clone --mirror git@github.com:pilasguru/test-sync.git Cloning into bare repository 'test-sync.git'... remote: Counting objects: 24, done. remote: Compressing objects: 100% (21/21), done. remote: Total 24 (delta 9), reused 15 (delta 3), pack-reused 0 Receiving objects: 100% (24/24), done. Resolving deltas: 100% (9/9), done. Checking connectivity... done
$ cd test-sync.git/ $ git show-ref | cut -d ' ' -f2 | grep 'pull-request' | xargs -r -L1 git update-ref -d
$ git push --mirror git@gitlab.com:pilasguru/test-sync.git Everything up-to-date
Configuración de repositorio local para hacerlo permanente:
$ git config -e
[core]
repositoryformatversion = 0
filemode = true
bare = true
symlinks = false
ignorecase = true
hideDotFiles = dotGitOnly
[remote "github"]
url = git@github.com:pilasguru/test-sync.git
fetch = +refs/heads/*:refs/heads/*
fetch = +refs/tags/*:refs/tags/*
mirror = true
[remote "mirror"]
url = git@gitlab.com:pilasguru/test-sync.git
mirror = true
skipDefaultUpdate = true
$ git remote update Fetching github $ $ git push mirror Everything up-to-date
Deploy Key con acceso read-only (pull) del repositorio con la llave publica generadaDeploy Key con acceso write access (push) del repositorio con la llave publica generada$ cd ~/test-sync.git && git remote update && git push mirror Fetching github Everything up-to-date
que se puede incluir en el cron del usuario o del sistema.