When creating a git repository that will be on the server, can I convert it to a bare repository? [duplicate]

人走茶凉 提交于 2019-12-17 22:27:17

问题


I already created a repository. Can I make it a bare type or shall I start over?


回答1:


According to the FAQ, conversion from non-bare to bare can be done in two ways. The best one:

$ git clone --bare -l repo repo.git
$ rm -rf repo

To create a bare repository from scratch:

$ mkdir repo.git
$ cd repo.git
$ git --bare init



回答2:


Just move the .git folder away from the working copy.

mv /var/git/repo/repo/.git /var/git/repos/repo.git

You might want to follow that up with a

git config --bool core.bare true

in that repository, just in case git complains about something not being right.




回答3:


git clone --bare repo

This will give you a new bare version of repo named repo.git. Easy, no?



来源:https://stackoverflow.com/questions/1784506/when-creating-a-git-repository-that-will-be-on-the-server-can-i-convert-it-to-a

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!