如何自动保持2个git仓库同步 [英] How to keep 2 git repositories in sync automatically

查看:927
本文介绍了如何自动保持2个git仓库同步的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

拥有2台服务器,这些服务器应始终保持彼此同步.

Having 2 servers which should be in sync with eachothers at all times.

当有人将某些内容推送到服务器A的存储库时,应根据主服务器/从属服务器自动更新服务器B上的存储库.

As someone pushes something to the repository of server A, the repository on server B should be updated automatically, depending what server is the master/slave.

两个服务器都不在同一台计算机上.

Both servers are not on the same machine.

是否可以在每次更新时都不必运行其他手动命令? (git fetch等.)还是您建议使用其他机制?

Is this possible without having to run additional manual commands every update? (git fetch etc.) Or do you advise a different mechanism?

推荐答案

您可以使用post-receiveupdate

You could use a post-receive or update Git Hook to push between repositories.

这篇关于如何自动保持2个git仓库同步的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆