Home > Software design >  git 2.34.1 dubious ownership error not fixed by safe.directory
git 2.34.1 dubious ownership error not fixed by safe.directory

Time:12-22

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?

CodePudding user response:

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 '*'
  •  Tags:  
  • git
  • Related