FAIL: Failed to fetch version from local git: fatal: detected dubious ownership in repository at '/opt/librenms' To add an exception for this directory, call: git config --global --add safe.directory /opt/librenms

Hello everyone:
This problem I tried a lot of methods can not be repaired

I have tried this command ./scripts/github-apply 14042
But there is this error

$ ./scripts/github-apply 14042
Checking patch LibreNMS/Validations/Updates.php…
error: while searching for:
use LibreNMS\Util\Version;
use LibreNMS\ValidationResult;
use LibreNMS\Validator;

class Updates extends BaseValidation
{

error: patch failed: LibreNMS/Validations/Updates.php:35
error: LibreNMS/Validations/Updates.php: patch does not apply
$ git config --global --add safe.directory /opt/librenms
$ ./scripts/github-apply 14042
Checking patch LibreNMS/Validations/Updates.php…
error: while searching for:
use LibreNMS\Util\Version;
use LibreNMS\ValidationResult;
use LibreNMS\Validator;

class Updates extends BaseValidation
{

error: patch failed: LibreNMS/Validations/Updates.php:35
error: LibreNMS/Validations/Updates.php: patch does not apply

Did I do anything wrong?

Hi, can you show the result of:
./daily.sh
./validate.sh
git remote get-url origin
git checkout

Also, did the problem came before or after you tried the patch? Why did you try it?

Did you run that as the librenms user?

Hi fbouynot:
Thanks for your reply.

Here is my output screen


I found this problem in the daily routine check .

Hi Murrany:
Thanks for your reply.

This did not work I have tried, I use this command (git config --global --add safe.directory /opt/librenms) in librenms account

Thanks

Can you post the output of:
find /opt/librenms/ ! -user librenms -exec ls -lahZ {} ;
ls -lahZ /opt/librenms

Hmm, maybe you need to run the command as whatever your webserver user is.