jesseduffield / jesseduffield/lazygit

lazygit error when GIT_TRACE env. variable is set

Open
#4,609 3 comments 1 reaction 0 assignees View on GitHub
bug
Dominant language
Go
Stars
82.4k
Forks
3k
Avg merge
2d 18h
Merged PRs (30d)
19

Description

**Describe the bug**

Lazygit fails to start

Image

**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](https://git-scm.com/book/en/v2/Git-Internals-Environment-Variables) that I forgot to clean later.

Setting the `GIT_TRACE=1` env. variable makes lazygit to crash.

```sh
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.

Image

Screenshots

Image

**Version info:**

```sh
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
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.