How to convert a normal Git repository to a bare one?

后端 未结 17 1209
礼貌的吻别
礼貌的吻别 2020-11-22 08:05

How can I convert a \'normal\' Git repository to a bare one?

The main difference seems to be:

  • in the normal Git repository, you have a .git

17条回答
  •  执念已碎
    2020-11-22 08:12

    Your method looks like it would work; the file structure of a bare repository is just what is inside the .git directory. But I don't know if any of the files are actually changed, so if that fails, you can just do

    git clone --bare /path/to/repo
    

    You'll probably need to do it in a different directory to avoid a name conflict, and then you can just move it back to where you want. And you may need to change the config file to point to wherever your origin repo is.

提交回复
热议问题