gitgit-worktree

git: fatal: unknown repository extensions found: worktreeconfig


I did a copy of a git repository from a Darwin host to a Linux host (ubuntu 18.04)

As far as I remember, I did not use worktree in this repository, but I might be wrong.

However, when typing "git status" on the repository "at target" (so Linux host), I get the following error:

kalou@majapatoche:~/xmp$ git status
fatal: unknown repository extensions found:
        worktreeconfig

So I tried to turn of any worktree related option in git config ... which fails

kalou@majapatoche:~/xmp$
m1:xmp kalou$ git config --list | grep orktre
extensions.worktreeconfig=true

m1:xmp kalou$ git config  extensions.worktreeconfig=false
error: invalid key: extensions.worktreeconfig=false

Trying to dig a little bit more, I remove any file within the .git directory related to "worktree" ... no success either ;

kalou@majapatoche:~/xmp$ find . | grep worktree
./.git/config.worktree
kalou@majapatoche:~/xmp$ rm .git/config.worktree
kalou@majapatoche:~/xmp$ git status
fatal: unknown repository extensions found:
        worktreeconfig

I'm using the following git version on Ubuntu 18.04 host:

kalou@majapatoche:~/xmp$ git --version
git version 2.17.1

Any hint on how to solve this ?


Solution

  • The extensions.worktreeconfig setting, if present and set to true, tells Git versions 2.20 and later that added working trees (from git worktree add) may have some per-worktree setting(s) in use.

    Since your Git is version 2.17, it does not support this. You can use:

    git config --unset-all extensions.worktreeconfig
    

    to remove the setting,1 but any per-worktree settings will be lost—not precisely a large loss since they were being ignored. This setting should never have gotten set though, with Git version 2.17. Archiving the .git repository and moving it to a machine with an older Git version (or sharing the .git repository directory via some networked file system) can result in this problem; that's one reason you're supposed to use git clone rather than simply packing up and moving the .git directory.

    Alternatively, you could upgrade your Git version to 2.20 or later. 2.17 is pretty old and stale at this point.


    1Setting it to false requires:

    git config extensions.worktreeconfig false
    

    (no = character here), but may not work since extensions.* settings are special.