[英]How to change a git repository cloned with --bare to match one cloned with --mirror?
这个问题与git不一样- 如何从其他仓库镜像文件或如何更新我的裸仓库?
由于与克隆一个仓库--mirror
是一个纯仓库,我可以与克隆一个仓库--bare
像一个与克隆--mirror
? 可以通过简单地修改配置文件来完成吗?
如果没有,是否有其他方法可以将裸存储库转换为镜像存储库?
另一个问题, 为什么我不能在镜像仓库中使用git push --all ,而这个命令可以在一个裸仓库中运行?
要将使用git clone --bare
克隆的存储库更改为与git clone --mirror
匹配的存储库,请执行以下操作:
$ git config remote.origin.fetch "+refs/*:refs/*"
$ git config remote.origin.mirror true
然后做一个git fetch
,一切都应该是最新的。
如果您使用git clone --mirror
clone克隆了您的repo,那么遵循默认matching
推送策略的git push --all
会将所有本地分支推送到远程仓库。
但是如果您的远程仓库已经作为远程引用添加到您的本地仓库(即您的本地git push --all secondRemoteRepo
已经从另一个远程git push --all secondRemoteRepo
克隆),那么git push --all secondRemoteRepo
将找不到许多匹配的分支来推送,除非你先取这些分支。
所以这应该工作:
git fetch secondRemoteRepo
git push --all secondRemoteRepo
如今:
git remote add --mirror=fetch origin <url>
然后
git fetch
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.