Changes to git stop some commands by the webserver to work

I have just created a new PVE Ubuntu 22.04 LXC in preparation to migrate my current LXC install to a new base OS.

I created a use pi and added it to the SUDO users and it all installed fine.

The issue is, I am not seeing any of the git info in the admin section

After some digging about it seems this is a new ‘feature’ of git. Currently the PiOS version does not seem to be affected as it is still 2.20.2, Ubuntu git version is 2.34.1.

I have raised a question on git 2.34.1 dubious ownership error not fixed by safe.directory - Stack Overflow

To demonstrate - emonpi

pi@emonpi:/var/www/emoncms $ git --version
git version 2.20.1
pi@emonpi:/var/www/emoncms $ sudo -u www-data git describe
11.2.7

Ubuntu 22.04

pi@emoncms:/var/www/emoncms$ git --version
git version 2.34.1
pi@emoncms:/var/www/emoncms$ sudo -u www-data git describe
fatal: detected dubious ownership in repository at '/var/www/emoncms'
To add an exception for this directory, call:

        git config --global --add safe.directory /var/www/emoncms

(and yes I did try that command :rofl: )

1 Like

The solution is to use the following command

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

I suspect at some point this will be necessary to add to EmonScripts @TrystanLea. Have not tried it on an emonSD setup to see if there are any ill effects on a lover git version.

This affects an upto date EmonSD image now.

You will notice the components page no longer shows the branch in use.

I have created a PR