Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git 2.34.1 dubious ownership error not fixed by safe.directory

Tags:

git

Running Ubuntu 22.04 in an LXC. git version is 2.34.1. Installed a web application under the user 'brian' but none of the calls to git work (this works fine on an PiOS system - git 2.20.1).

I have found I am getting a return error of 128 and trying to run git commands from the command line as www-data user, result in the error

fatal: detected dubious ownership in repository at

From the announcement of 2.36 https://github.blog/2022-04-18-highlights-from-git-2-36/#stricter-repository-ownership-checks it look like this should be fixed by adding a safe.directory option.

However, I am running 2.34.1. I have tried to use this command

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

(with and without sudo) as the user brian, to no effect - the error continues.

I also tried it for the specific directory as well, with no success.

Any suggestions how to fix?

like image 249
Brian Avatar asked Oct 12 '25 17:10

Brian


1 Answers

The answer (for me currently) is to use --system rather than --global

This command worked on a fresh install (sudo if not root);

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

Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!