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.
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.
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.