Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git: fatal: detected dubious ownership

I work with a new Windows installation and the same folder on my network share (NAS System). After installing git and tortoisegit I tried to connect to the git repository, but I always get this error. What has changed is the server and not the user.

enter image description here

I have run

git config --global --add safe.directory '*'

But that changes nothing. How can I fix this?

Where can I set the variable

GIT_TEST_DEBUG_UNSAFE_DIRECTORIES=true
like image 919
Matthias Pospiech Avatar asked Sep 02 '25 06:09

Matthias Pospiech


2 Answers

This happens when a repo was cloned by a different user than your current user. In my case, I've encountered this issue after reinstalling windows, but using previously cloned git repositories (on a separate partition).

  • Right-click repo folder, properties, security, advanced.
  • Click "Change" on the Owner line.
  • Find your user (advanced..., find now, select your user). Confirm.
  • On the change screen, enable "Replace owner on subcontainers and objects".

That should fix the error.

If you intend to use more than one user on a cloned repo, then I'd follow git instructions to add the exception.

like image 175
scx Avatar answered Sep 04 '25 23:09

scx


git config --global --add safe.directory *

This worked for me, minor difference.

like image 22
Jon Gan Avatar answered Sep 05 '25 00:09

Jon Gan