且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

设置每个裸回购的工作树

更新时间:2023-02-14 21:55:19

Bare repos are not supposed to have a work tree, so git prints the "fatal: core.bare and core.worktree do not make sense" error message. Therefore, you need to set bare = false in the repo's config file.

user@host:~$ cd barerepo
user@host:~/barerepo$ git config --bool core.bare false
user@host:~/barerepo$ git config --path core.worktree /var/www/mywork

However, if barerepo did not previously exist, you should use this command instead:

git init --separate-git-dir=. /var/www/mywork

This command will also create a .git file in the work tree pointing to the git dir:

gitdir: /home/user/barerepo

相关阅读

技术问答最新文章