git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Recovering from 'fatal: core.bare and core.worktree do not make sense'

From
SZEDER Gábor <szeder@ira.uka.de>
Date
May 27, 2015, 10:31 UTC
Message-ID
<20150527123147.Horde.GqzoX-7JvXiOGBlB5moP4A8@webmail.informatik.kit.edu>
Hi,

the other day I said 'git config core.worktree /somewhere' in a bare repo while thinking I was in a regular one, user error. The 'fatal: core.bare and core.worktree do not make sense' error from the next command made me realize immediately that I was wrong, that's good. However...

OK, let's have a look and recover from the situation:
    $ git config --edit
    fatal: core.bare and core.worktree do not make sense
Well, all was well before I set 'core.worktree', so let's unset it:
    $ git config --unset core.worktree
    fatal: core.bare and core.worktree do not make sense

Hmph, not expecting much, but how about unsetting the other variable?

    $ git config --unset core.bare
    fatal: core.bare and core.worktree do not make sense

Good, at least it's pretty consistent, though I still don't get what 'git config' has to do with the worktree that is so important that it has to bail out. Time to look for help:

    $ git help config
    fatal: core.bare and core.worktree do not make sense

WTF :) Alright, I give up:

    $ vim config
    $ # happy

It was two days later that I had a bit of a lightbulb moment, reproduced the situation and just for fun tried this:

    $ git -c core.bare=false config --unset core.bare
I didn't expect, but it worked!  Great.
Some thoughts:
    1) Perhaps 'git config' should be more careful in the first place
       and refuse to set 'core.worktree' when 'core.bare' is already
       true and vice versa.
    2) The damage was done with 'git config', so I expected that I can
       repair it with "plain" 'git config' (i.e. without 'git -c') as
       well.  'git config' has nothing to do with the path to the
       worktree after all.  And 'git config --edit' should work
       regardless of the mess that might be in the config file.
    3) 'git help <cmd>' should always work, shouldn't it?  (Though
       that's the easiest to remedy, just cd out of the repo, or fire
       up a new terminal window.)
Gábor
Next: Jeff King
Message 1 of 2 in “Recovering from 'fatal: core.bare and core.worktree do not make sense'”
  1. SZEDER GáborMay 27, 2015
  2. setup_git_directory: delay core.bare/core.worktree errorsJeff King, May 29, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.