简体   繁体   English

如何将一个git repo镜像并同步到另一个git repo?

[英]How to mirror and sync one git repo to another git repo?

I have a remote repository A and I want to mirror to a new remote repository B. I also want to sync A to B regularly like daily. 我有一个远程存储库A,我想镜像到新的远程存储库B。我也想像每天一样定期将A同步到B。 How can I do that? 我怎样才能做到这一点?

There are multiple ways of doing this. 有多种方法可以做到这一点。 One way is to add repo B to repo A as a remote repo. 一种方法是将存储库B添加到存储库A作为远程存储库。 The command to do this would be run from repo A: 可以从仓库A运行此命令:

git remote add <repo B name> <repo B URL>

From there on you can push to using the mirror option. 从那里开始,您可以继续使用镜像选项。 The command to do this would be run from repo A too such as: 也可以从仓库A运行此命令,例如:

git push --mirror <repo B name>

This should push all your refs up to repo B. I hope this helps. 这应该将您所有的裁判推到回购B。我希望这会有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM