Git

How do I make existing non-bare repository bare?

adtxl
2021-06-21 / 1 评论 / 1,021 阅读 / 正在检测是否收录...

1.stackoverflow

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

2.How do I make existing non-bare repository bare?

https://git.wiki.kernel.org/index.php/GitFaq#How_do_I_make_existing_non-bare_repository_bare.3F

After making sure that there are no uncommitted changes, etc.:

$ mv repo/.git repo.git
$ git --git-dir=repo.git config core.bare true
$ rm -rf repo

The problem with the above process is that it doesn't take into account future internal changes of Git. A safer method is to let Git handle all the internal settings for you by doing something like this.

* ssh to remote server
* git clone --bare -l <path_to_repos> <new_dir>
* renamed old repository directory
* renamed new repository dir to what old repository used to be.
other

git config --bool core.bare false
git config --bool core.bare true

0

评论 (1)

取消
  1. 头像

    [...]How do I make existing non-bare repository bare? – 君の内存[...]

    回复