Error message: detected dubious ownership in repository
git threw the error message
detected dubious ownership in repository when I
cloned a
repository with elevated privileges (local administrator?) and then tried to
add a file as «ordinary» user:
PS: P:/ath/to/repo> git add xyz.txt
fatal: detected dubious ownership in repository at 'P:/ath/to/repo'
To add an exception for this directory, call:
git config --global --add safe.directory P:/ath/to/repo
Set the environment variable GIT_TEST_DEBUG_UNSAFE_DIRECTORIES=true and run
again for more information.
PS: P:/ath/to/repo> $env:GIT_TEST_DEBUG_UNSAFE_DIRECTORIES='true'
PS: P:/ath/to/repo> git add xyz.txt
warning: 'P:/ath/to/repo' is owned by:
'S-1-5-32-544'
but the current user is:
'S-1-5-21-4263153355-2452838509-1987978020-1000'
...
Only forward slashes recognized
It seems that git does not correctly interpret backslashes (on Windows, that is) in the value of safe.directory. So, backslashes need to be replaced by forward slashes.