'How to keep one Gitlab repo in sync with the other [mirroring][gitlab-gitlab]
How do I mirror one gitlab repository with the another.
I have a repository which should be in sync with the protected branches of another repository.
Solution 1:[1]
I solved this by writing a Gitlab server hook like the following for ALL REPOSITORIES (look at the posted official guide link):
#!/bin/sh
# https://docs.gitlab.com/ee/administration/server_hooks.html#create-a-server-hook-for-a-repository
# Encode path slashes with dots.
FIXED_PROJECT_PATH=$(echo ${GL_PROJECT_PATH} | sed -r 's:/:\.:g')
# Mirror the repository, even if does not yet exist.
PROJECT_URI=<<GITLAB_MIRROR_URL>>/${FIXED_PROJECT_PATH}.git
git push --mirror ${PROJECT_URI}
exit 0 # Force successfully execution
NB: remember to subsitute <<GITLAB_MIRROR_URL>> with your own.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Antonio Petricca |
