-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Error at launch with symlink .git file #5421
Description
Describe the bug
I'm working in a project that recently underwent a large file migration. Part of that migration was changing the .git file to be a symlink to another location on disk.
After a fresh clone of the repository, when I try and open lazygit in the project folder, I get the following error:
2026/03/26 11:00:17 An error occurred! Please create an issue at: https://github.com/jesseduffield/lazygit/issues
*errors.errorString Error getting repo paths: 'git -C /home/lee/Documents/projects/core/firmware/protected/redacted rev-parse --path-format=absolute --show-toplevel --absolute-git-dir --git-common-dir --is-bare-repository --show-superproject-working-tree' failed: /home/lee/Documents/projects/core/firmware/protected/redacted
/home/lee/Documents/projects/core/.repo/projects/firmware/protected/redacted.git
/home/lee/Documents/projects/core/.repo/projects/firmware/protected/redacted.git
false
BUG: submodule.c:2455: returned path string doesn't match cwd?
/home/runner/work/lazygit/lazygit/pkg/commands/git.go:67 (0xa761d1)
/home/runner/work/lazygit/lazygit/pkg/gui/gui.go:323 (0xc32c25)
/home/runner/work/lazygit/lazygit/pkg/gui/gui.go:883 (0xc37ab6)
/home/runner/work/lazygit/lazygit/pkg/gui/gui.go:904 (0xc38328)
/home/runner/work/lazygit/lazygit/pkg/utils/utils.go:80 (0x802cb6)
/home/runner/work/lazygit/lazygit/pkg/gui/gui.go:903 (0xc3825f)
/home/runner/work/lazygit/lazygit/pkg/app/app.go:277 (0xc99bba)
/home/runner/work/lazygit/lazygit/pkg/app/app.go:48 (0xc99b4a)
/home/runner/work/lazygit/lazygit/pkg/app/entry_point.go:177 (0xc9bed6)
/home/runner/work/lazygit/lazygit/main.go:23 (0xc9d278)
/opt/hostedtoolcache/go/1.25.7/x64/src/internal/runtime/atomic/types.go:194 (0x44a57d)
/opt/hostedtoolcache/go/1.25.7/x64/src/runtime/asm_amd64.s:1693 (0x488a61)
In this case, my working directory is /home/lee/Documents/projects/core/firmware/protected/redacted (which is the location of the symlink .git file), and the target of the .git symlink is /home/lee/Documents/projects/core/.repo/projects/firmware/protected/redacted.git.
If I open lazygit in any subfolders, it doesn't recognize that it is within a git folder structure.
Calling git commands via the command line work normally (ie. git status).
To Reproduce
Steps to reproduce the behavior:
- Create a project that contains a .git file which is symlink'd to another location.
- Open lazygit within the directory that contains the symlink'd .git file.
Expected behavior
lazygit should behave normally and open the project like it would without a symlink.
Version info:
commit=2f6d20275afd5fc9b623500c9194a2c732936014, build date=2026-03-09T19:51:31Z, build source=binaryRelease, version=0.60.0, os=linux, arch=amd64, git version=2.43.0
Terminal info:
GNOME Terminal, Ubuntu 24.04.4 LTS