jesseduffield / jesseduffield/lazygit

"failed: fatal: detected dubious ownership in repository" when running lazygit on a newly initialized repository on a external drive

Open
#3,757 0 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**
When trying to run lazygit on a newly initialized repository on an external drive it throws a fatal error. A similar error with a suggested command to run is shown when manually running 'git status' aswell. Running the suggested command fixes the issue.

**Console Log:**
_**PS F:\RustProjects\Practice\documentation_generator> git init**
**PS F:\RustProjects\Practice\documentation_generator> lazygit**
2024/07/17 20:33:34 An error occurred! Please create an issue at: https://github.com/jesseduffield/lazygit/issues

*errors.errorString 'git -C F:\RustProjects\Practice\documentation_generator rev-parse --path-format=absolute --show-toplevel --absolute-git-dir --git-common-dir --is-bare-repository --show-superproject-working-tree' failed: fatal: detected dubious ownership in repository at 'F:/RustProjects/Practice/documentation_generator'
'F:/RustProjects/Practice/documentation_generator' is on a file system that does not record ownership
To add an exception for this directory, call:

git config --global --add safe.directory F:/RustProjects/Practice/documentation_generator

/home/runner/work/lazygit/lazygit/pkg/commands/git_commands/repo_paths.go:147 (0x11017b8)
/home/runner/work/lazygit/lazygit/pkg/commands/git_commands/repo_paths.go:91 (0x1100f88)
/home/runner/work/lazygit/lazygit/pkg/commands/git_commands/repo_paths.go:83 (0x1100e4c)
/home/runner/work/lazygit/lazygit/pkg/app/app.go:123 (0x13103f5)
/home/runner/work/lazygit/lazygit/pkg/app/app.go:45 (0x130fcb8)
/home/runner/work/lazygit/lazygit/pkg/app/entry_point.go:161 (0x1311ef7)
/home/runner/work/lazygit/lazygit/main.go:23 (0x1313858)
/opt/hostedtoolcache/go/1.22.5/x64/src/runtime/internal/atomic/types.go:194 (0xb820eb)
/opt/hostedtoolcache/go/1.22.5/x64/src/runtime/asm_amd64.s:1695 (0xbb8d81)

**PS F:\RustProjects\Practice\documentation_generator> git status**
fatal: detected dubious ownership in repository at 'F:/RustProjects/Practice/documentation_generator'
'F:/RustProjects/Practice/documentation_generator' is on a file system that does not record ownership
To add an exception for this directory, call:

git config --global --add safe.directory F:/RustProjects/Practice/documentation_generator

**PS F:\RustProjects\Practice\documentation_generator> git config --global --add safe.directory F:/RustProjects/Practice/documentation_generator_**

**To Reproduce**
Steps to reproduce the behavior:

1. Initialize a new git repository on a external drive (SSDwith exFat partition to be precise) using 'git init'
2. Try to run lazygit in the same repo. It throws a fatal error.

**Expected behavior**
I would expect lazygit to run normally but throw that error as a popup dialog explaining the problem and offering two options: to run the suggested command or to quit.

**Version info:**
commit=71ad3fac63a3ef3326021837b49e9497d332818b, build date=2024-07-13T10:24:19Z, build source=binaryRelease, version=0.43.1, os=windows, arch=amd64, git version=2.44.0.windows.1
git version 2.44.0.windows.1

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.