git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Recovering from 'fatal: core.bare and core.worktree do not make sense'
@ 2015-05-27 10:31 SZEDER Gábor
  2015-05-29  6:49 ` [PATCH] setup_git_directory: delay core.bare/core.worktree errors Jeff King
  0 siblings, 1 reply; 2+ messages in thread
From: SZEDER Gábor @ 2015-05-27 10:31 UTC (permalink / raw)
  To: Git Mailing List


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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-05-29  6:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-27 10:31 Recovering from 'fatal: core.bare and core.worktree do not make sense' SZEDER Gábor
2015-05-29  6:49 ` [PATCH] setup_git_directory: delay core.bare/core.worktree errors Jeff King

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).