Daily update fails with gitignore error

Since the May update, I get this message every night:
“error: Your local changes to the following files would be overwritten by
checkout:
storage/app/.gitignore
Please commit your changes or stash them before you switch branches.
Aborting”.

I ran validate.php which gave me some lines of code to run to get ownership of a folder to librenms. Then, validate.php ran without this error, but the daily update still failed. I can read and edit gitignore.php, but nothing in there makes any sense to me. I tried to stash save the gitignore.php, I even renamed the gitignore.php, but none of those changed anything.

Can anyone point me to step-by-step what I can do to fix this and get back on the daily update schedule? Thank you.

If you have no other files that have been changed, then as per the output, stash the changes: git stash save

I’ve tried that. Do I do it in the same directory where the gitignore is? When it works, should there be a confirmation message? There was no success or fail message returned in the terminal window. Thank you.

Just do it in /opt/librenms and no response back is good.

I did that, but the next daily update still failed with the same error message.
I will try again as sudo. Anything else I should check? Thank you.

This is still an on-going issue.
GIT STASH SAVE did not work. I ran it in the opt/librenms directory.
I ran it then with sudo, and that generated an error message:
“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”
I typed that git config line into terminal, but I continue to get the error.
Thanks for your suggestions.

The file only flags up if it’s changing so you’ve either got something that’s changing the file or you are. LibreNMS won’t touch that file so running git stash save as the librenms will restore it to what it should be.

SOLVED:
“sudo -u librenms git stash save”
ran the git stash save as the librenms user.
Thanks for your help.