#!/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
2条答案
按热度按时间ccrfmcuu1#
我通过编写一个Gitlab服务器钩子来解决这个问题,如下所示,用于ALL REPOSITORIES(查看发布的官方指南链接):
**注意:**记得用您自己的
<<GITLAB_MIRROR_URL>>
替换。mpbci0fu2#
你可以使用GitLab的mirroring功能来实现这一点,它是内置在平台中的。