lazygit
lazygit copied to clipboard
lazygit error when GIT_TRACE env. variable is set
Describe the bug
Lazygit fails to start
To Reproduce
The simple invocation lazygit command started to produce this issue after my last system restart.
Searching online I couldn't find a similar recent error. The culprit was a recent change to my shell environment while debugging git commands that I forgot to clean later.
Setting the GIT_TRACE=1 env. variable makes lazygit to crash.
GIT_TRACE=true lazygit
2025/05/29 17:49:18 An error occurred! Please create an issue at: https://github.com/jesseduffield/lazygit/issues
*fs.PathError chdir 17:49:18.170936 git.c:476 trace: built-in: git rev-parse --path-format=absolute --show-toplevel --absolute-git-dir --git-common-dir --is-bare-repository --show-superproject-working-tree: no such file or directory
github.com/jesseduffield/lazygit/pkg/utils/errors.go:13 (0x1031269dc)
github.com/jesseduffield/lazygit/pkg/commands/git.go:70 (0x1031269dd)
github.com/jesseduffield/lazygit/pkg/gui/gui.go:304 (0x1032bbe20)
github.com/jesseduffield/lazygit/pkg/gui/gui.go:854 (0x1032bfff0)
github.com/jesseduffield/lazygit/pkg/gui/gui.go:873 (0x1032c0498)
github.com/jesseduffield/lazygit/pkg/utils/utils.go:81 (0x102f150ec)
github.com/jesseduffield/lazygit/pkg/gui/gui.go:872 (0x1032c0404)
github.com/jesseduffield/lazygit/pkg/app/app.go:270 (0x1033125e0)
github.com/jesseduffield/lazygit/pkg/app/app.go:48 (0x103312599)
github.com/jesseduffield/lazygit/pkg/app/entry_point.go:168 (0x103314150)
github.com/jesseduffield/lazygit/main.go:23 (0x103315378)
internal/runtime/atomic/types.go:194 (0x102b9d074)
runtime/asm_arm64.s:1223 (0x102bdabe4)
Expected behavior
lazygit opens and extended trace logs are reported into the command log pane.
Screenshots
Version info:
lazygit --version
commit=, build date=, build source=Homebrew, version=0.51.1, os=darwin, arch=arm64, git version=2.49.0
git --version
18:22:31.611516 git.c:476 trace: built-in: git version
git version 2.49.0
That's a long-standing, known problem, see https://github.com/jesseduffield/lazygit/issues/2050#issuecomment-1983042044 (and the comment before that). Fixing it is probably quite a bit of work, but not impossible. Didn't have high priority for me so far, since there's the easy workaround of unsetting GIT_TRACE. 😄
Thank you for the quick reply and information. I couldn't find that issue from my search. Indeed, that's the simple fix and as described I discover this error just by mistake as I forgot to remove the var. My intention is to report the error to help others if they stumble with it (also probably by mistake too 😅), and in the case it can be solved with low effort perhaps get attention to it. I'm happy to contribute, but as you mention the cost/benefit doesn't justify
Thanks. This helped me to spend hours searching: unset GIT_TRACE