如何将git repo同步到镜像仓库

问题描述 投票:1回答:2

我想将git repo镜像到我的本地仓库,并希望及时同步它们,我这样做:

git clone --mirror source_url source_repo
cd source_repo
git push --mirror local_url

现在我已经将源代码镜像到我的本地仓库,我可以像这样克隆我的本地仓库:

git clone local_url local_repo

但是由于源代码库正在更新,我怎么能让它们保持同步?

git synchronization mirror
2个回答
1
投票

这里有几种方法。您可以选择一个方便的。

  1. https://softwareengineering.stackexchange.com/questions/195456/keeping-git-repositories-on-different-hosts-in-sync讨论的方法(编写脚本等)
  2. 添加自定义钩子到你的git repo - https://www.digitalocean.com/community/tutorials/how-to-use-git-hooks-to-automate-development-and-deployment-tasks
  3. 如果你使用像BitBucket这样的第三方工具,他们应该有内置的解决方案或插件。例如:https://marketplace.atlassian.com/plugins/com.englishtown.stash-hook-mirror/server/overview

0
投票

任何镜像或工作的本地存储库都可以与git remote update同步

cd REPO
git remote update
© www.soinside.com 2019 - 2024. All rights reserved.