As you can see below I have to set the work-tree of a bare repo:
cd barerepo
git status
fatal: This operation must be run in a work tree
git --work-tree=/va
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