【发布时间】:2021-02-11 00:43:41
【问题描述】:
我的目标是简化更新我的 git 镜像克隆的过程。
我有一个由供应商提供的 git 存储库 repo-A
我有一个 git 存储库 repo-B 在我的本地 git 中
我能够克隆 repo-A 添加 repo-B 作为远程并推送到 repo-B。使用此命令
git clone --mirror repo-A
git remote add my-local-server repo-B
git push --mirror my-local-server
结果是repo-B 包含与repo-A 相同的分支、提交等。此时我可以从repo-A获取新代码并将其推送到repo-B
问题是如果我在另一台计算机上克隆repo-B。遥控器配置丢失。
这意味着,如果我执行 git remote -v,则只有指向 repo-B 的链接存在。
是否可以配置 repo-B 以便即使在新克隆远程存储库链接之后也存在?
我的目标是能够做到
git clone repo-B
git fetch --all origin /* or the name of location repo-A is located */
git push --all my-local-server
我知道类似的行为可以通过
git clone --mirror repo-A
git push --mirror repo-B
【问题讨论】:
标签: git git-clone git-mirror