作者:luotingyou492 | 来源:互联网 | 2023-06-20 19:09
我已经尝试过以下方法,并且效果很好。但是,它只是从本地提交并推送到git,然后将其推送到远程服务器。
git remote add origin https://code.company.com/autodeployment/fiver.git
git remote set-url --add --push origin https://code.company.com/autodeployment/fiver.git
git remote set-url --add --push origin fiver@server01.company.com:/var/fiver/fiver.git
我想从本地提交并推送到Git,Git应该有一个custom_hook,远程服务器将在其中自动获取或Git将自动推送到远程服务器。
不要为此烦恼。只需定义一个推镜即可。如果您想知道,则可以在CE版本中使用(仅拉镜需要EE版本)。
转到您的存储库>设置>存储库>镜像设置,然后按照指南进行操作。
到目前为止,我遇到的唯一非常小的缺点是两次推入之间的限制为5分钟。但这在现实生活中很少会成为障碍,因为如果您确实需要,您仍然可以手动将其推入所有遥控器。
参考:https://docs.gitlab.com/ee/user/project/repository/repository_mirroring.html