Skip to content

Error when trying to run lazygit in bare repo #5469

@x1unix

Description

@x1unix

Describe the bug

I've a bare repo with worktrees. When I'm trying to run lazygit in bare repo root, I get the following error:

2026/04/03 10:04:43 An error occurred! Please create an issue at: https://github.com/jesseduffield/lazygit/issues

*errors.errorString Error getting repo paths: 'git -C /home/x1unix/prometheus rev-parse --path-format=absolute --show-toplevel --absolute-git-dir --git-common-dir --is-bare-repository --show-superproject-working-tree' failed: fatal: this operation must be run in a work tree

github.com/jesseduffield/lazygit/pkg/commands/git.go:67 (0x55bd8bde4f11)
github.com/jesseduffield/lazygit/pkg/gui/gui.go:323 (0x55bd8bf80f25)
github.com/jesseduffield/lazygit/pkg/gui/gui.go:883 (0x55bd8bf85ed6)
github.com/jesseduffield/lazygit/pkg/gui/gui.go:904 (0x55bd8bf86748)
github.com/jesseduffield/lazygit/pkg/utils/utils.go:80 (0x55bd8bb74696)
github.com/jesseduffield/lazygit/pkg/gui/gui.go:903 (0x55bd8bf86676)
github.com/jesseduffield/lazygit/pkg/app/app.go:277 (0x55bd8bfe523a)
github.com/jesseduffield/lazygit/pkg/app/app.go:48 (0x55bd8bfe51ca)
github.com/jesseduffield/lazygit/pkg/app/entry_point.go:177 (0x55bd8bfe7530)
github.com/jesseduffield/lazygit/main.go:23 (0x55bd8bfe8893)
internal/runtime/atomic/types.go:194 (0x55bd8b7bb3f5)
runtime/asm_amd64.s:1771 (0x55bd8b7fa6c1)

To Reproduce

# 1. Setup repo
mkdir prometheus && cd prometheus
git clone --bare https://github.com/x1unix/prometheus.git .bare
echo 'gitdir: ./.bare'
git remote add upstream https://github.com/prometheus/prometheus.git
git fetch --all

# 2. Create some worktree
git worktree add foobar origin/main

# 3. Run lazygit, but don't cd into a worktree
lazygit

Expected behavior

I want to be able to use lazygit within a bare repo root.

Screenshots

Image

Version info:

commit=v0.60.0, build date=2026-03-09T21:02:48Z, build source=binaryRelease, version=0.60.0, os=linux, arch=amd64, git version=2.53.0

Terminal info:

kitty 0.46.2 created by Kovid Goyal

Additional context

Add any other context about the problem here.

Note

Please try updating to the latest version or manually building the latest master to see if the issue still occurs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions