[英]Best way to synchronize 2 git repos
What would be the best way of synchronizing two repos(one being a mirror) and keep it updated 同步两个存储库(一个为镜像)并保持更新的最佳方法是什么?
Orignal step 原始步骤
$ git clone --mirror git@example.com/ori.git
$ cd upstream-repository.git
$ git push --mirror git@example.com/new-location.git
Based on Cronjob 基于Cronjob
$ cd upstream-repository.git
$ git remote update
$ git push --mirror git@example.com/new-location.git
Does it make sense ? 是否有意义 ?
Does it make sense ?
是否有意义 ?
It depends on your remote server. 这取决于您的远程服务器。
If you are pushing to the same git repo server, you could have a local backup repo with a regular pull from another local repo of that server. 如果要推送到同一个 git repo服务器,则可以从该服务器的另一个本地repo中定期提取本地备份repo。
Regarding your git remote update
, see " Check if pull needed in Git ": you can check if you have received any commit at all; 关于
git remote update
,请参阅“ 检查Git中是否需要拉取 ”:您可以检查是否已收到任何提交; if not, not need to push. 如果没有,则不需要推动。
If you are pushing to another server which might not be listening for git queries, then you would use git bundle
, which means transferring only one file (as I mentioned here ) 如果您要推送到另一台可能未监听git查询的服务器,则可以使用
git bundle
,这意味着仅传输一个文件(如我在此处提到的)
. 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.