问题描述
我想将我的Git存储库转换为裸机。我清楚地记得以前做过这个工作的git remove-tree,但是我在1.7上找不到它。你能帮我吗?
感谢你们,这是通过将回购协议移到不同的地方,然后设置the bare = true option。
这次我必须说我的记忆已经失败了。删除工作副本的技巧是我以前在Bazaar上做的:)
反正 - 感谢你的答案。
.git / config $ c中的设置$ c>等。另一种方法是只重用 .git
目录作为裸仓库,例如通过做:
cd my-repo
mv .git ../my-repo.git
cd ../my-repo.git
git config core.bare true
.. 。这会使你的工作树和 my-repo.git
成为一个裸机版本的 my-repo
同一个存储库。
I'd like to convert my Git repository to a bare one. I distinctly remember something like git remove-tree that did the job previously but I can't find it on 1.7. Could you help me out?
Thanks guys, that did it with the moving of repo to a different place and then setting the bare=true option.
I must say my memory has failed me this time. The trick with removing working copy that I did previously was with Bazaar :)
Anyways - thanks for the answers.
解决方案 Cloning your git repository, as suggested in Skydreamer's answer, may be fine for what you want, but it would lose remote-tracking branches, settings in .git/config
, etc. An alternative is to just reuse the .git
directory as a bare repository, e.g. by doing:
cd my-repo
mv .git ../my-repo.git
cd ../my-repo.git
git config core.bare true
... which will leave my-repo
with just your working tree, and my-repo.git
as a bare version of the same repository.
这篇关于如何从Git存储库中删除工作树的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!