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?
error: could not lock config file /var/www/.gitconfig: Permission denied
www-data
does not have permission to update (or perhaps create, or both) "his" (its) own config file. You can do what you did (--system
) if you're willing to disable all security for all users, or you can just create or update the/var/www/.gitconfig
file by whoever it is that does have permission to create it. It's probably wisest to use the narrowestsafe.directory
setting possible: e.g., list just the directory or directories that should be considered safe.www-data
has/var/www
set as its $HOME).