{"thread":{"id":"54233","subject":"Worktrees attached to bare repo don't work","startedAt":"2020-09-12T20:01:36Z","lastAt":"2020-09-13T04:50:19Z","messageCount":2,"participants":["Lobachevksiy Vitaliy","Eric Sunshine"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"405478","messageId":"3b57a5b2-a34e-de95-38c7-9bc6923a8eba@yandex.ru","threadId":"54233","inReplyTo":null,"subject":"Worktrees attached to bare repo don't work","fromName":"Lobachevksiy Vitaliy","fromEmail":"numzer0@yandex.ru","sentAt":"2020-09-12T19:59:26Z","receivedAt":"2020-09-12T20:01:36Z","isPatch":false,"sender":{"key":"numzer0@yandex.ru","avatar":null},"body":"I have a bare repository and several worktrees attached to it. That was\nworking fine until recent update. Now when I try virtually any git\ncommand like `git status` in any attached worktree, or even in a new\none, it prints `fatal: this operation must be run in a work tree`.\nThe workaround is simply `git config --worktree --add core.bare false`\nin each worktree.\n\nI have git version 2.28.0 on Void Linux (musl, amd64).\n\n-- \nVitaliy `numzero`\n"},{"id":"405486","messageId":"CAPig+cRqkzPzNX8UN4OcgEOOKbtZRLCjNNiZsOVkGBy0pvsEkQ@mail.gmail.com","threadId":"54233","inReplyTo":"3b57a5b2-a34e-de95-38c7-9bc6923a8eba@yandex.ru","subject":"Re: Worktrees attached to bare repo don't work","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2020-09-13T04:49:59Z","receivedAt":"2020-09-13T04:50:19Z","isPatch":false,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Sat, Sep 12, 2020 at 4:01 PM Lobachevksiy Vitaliy <numzer0@yandex.ru> wrote:\n> I have a bare repository and several worktrees attached to it. That was\n> working fine until recent update. Now when I try virtually any git\n> command like `git status` in any attached worktree, or even in a new\n> one, it prints `fatal: this operation must be run in a work tree`.\n> The workaround is simply `git config --worktree --add core.bare false`\n> in each worktree.\n\nThis is happening because you have apparently set the configuration\nvariable extensions.worktreeConfig to true. As far as I can tell by\nreading the \"Configuration File\" section of the \"git worktree\"\ndocumentation and by consulting the commit[1] which introduced\nextensions.worktreeConfig, this is working as intended. According to\nthe \"git worktree\" documentation, configuration core.bare is no longer\nspecially filtered out when inside a worktree once\nextensions.worktreeConfig is enabled, so you need to move the\ncore.bare=true setting out of the bare.git/config and into\nbare.git/config.worktree to prevent the worktrees from seeing that\nsetting. Once that's done, you don't need the per-worktree\ncore.bare=false setting you've been using as a workaround.\n\n[1]: https://lore.kernel.org/git/20181021140228.24941-3-pclouds@gmail.com/\n"}]}