如何更改用--bare克隆的git存储库,以匹配用--mirror克隆的git存储库? [英] How to change a git repository cloned with --bare to match one cloned with --mirror?
问题描述
此问题与 git-如何镜像文件不同来自其他回购或我如何更新裸回购?
由于用--mirror
克隆的存储库是裸存储库,因此我可以使用--bare
克隆的存储库像用--mirror
克隆的存储库一样吗?可以通过简单地修改配置文件来完成吗?
Since a repository cloned with --mirror
is a bare repository, can I make a repository cloned with --bare
be like one cloned with --mirror
? Can it be done by simply modifying the config file?
如果没有,是否还有其他方法可以将裸存储库转换为镜像存储库?
If not, is there other method which can convert a bare repository to a mirror repository?
另一个问题,为什么我不能在镜像存储库中使用git push --all ,而该命令可以在裸存储库中运行?
Another question, Why can I not use git push --all in a mirror repo, while this command can be ran in a bare repo?
推荐答案
要将使用git clone --bare
克隆的存储库更改为与使用git clone --mirror
的存储库相匹配的存储库,请执行以下操作:
To change a repository cloned with git clone --bare
into one that matches what it would be with a git clone --mirror
, do the following:
$ git config remote.origin.fetch "+refs/*:refs/*"
$ git config remote.origin.mirror true
然后执行git fetch
,一切都应该是最新的.
Then do a git fetch
and everything should be up-to-date.
这篇关于如何更改用--bare克隆的git存储库,以匹配用--mirror克隆的git存储库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!