Page MenuHomePhabricator

git fatal: detected dubious ownership in repository at '/srv/codesearch'
Open, Needs TriagePublic

Description

See also T325128: git: detected dubious ownership in repository at '/srv/mediawiki-staging'

krinkle@codesearch8:/srv/codesearch$ git log
fatal: detected dubious ownership in repository at '/srv/codesearch'
To add an exception for this directory, call:

	git config --global --add safe.directory /srv/codesearch

krinkle@codesearch8:/srv/codesearch$ ll
total 192K
drwxr-xr-x 8 codesearch codesearch 4.0K Dec 14 21:06 ./
drwxr-xr-x 5 root       root       4.0K Apr  9  2021 ../
-rw-r--r-- 1 codesearch codesearch  249 Oct  8 02:36 .editorconfig
drwxr-xr-x 8 codesearch codesearch 4.0K Dec 14 22:06 .git/
drwxr-xr-x 6 codesearch codesearch 4.0K Oct  8 02:55 frontend/
drwxr-xr-x 2 codesearch codesearch 4.0K May 20  2021 hound/
-rwxr-xr-x 1 codesearch codesearch  436 Apr  9  2021 manage.sh*
-rw-r--r-- 1 codesearch codesearch  192 Mar 11  2022 requirements.txt
..

Event Timeline

For now I've run git config --global --add safe.directory /srv/codesearch in order to unblock a deployment.

For now I've run git config --global --add safe.directory /srv/codesearch in order to unblock a deployment.

Do you know where it wrote this to? /etc/gitconfig is puppetized and I don't see it in your home directory either. But in any case, this seems fine because we trust the codesearch git repo, otherwise we're screwed anyways.

krinkle@codesearch8:/srv/codesearch$ git log
fail

krinkle@codesearch8:/srv/codesearch$ git log
success

krinkle@codesearch8:/srv/codesearch$ sudo git config --global --list
safe.directory=/srv/codesearch

krinkle@codesearch8:/srv/codesearch$ sudo git config --global --list --show-origin
file:/root/.gitconfig   safe.directory=/srv/codesearch

I ended up saving it specifically to root, which isn't ideal. git config --system -> /etc/gitconfig indeed would be a better place.

BTullis added a parent task: Restricted Task.May 25 2023, 10:47 AM
BTullis subscribed.

In case it helps, I've added {T335354} as a parent of this. That describes the reason why we're seeing this error in various places recently and there are a few patches linked there which might help with config management.