更新时间: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