SyncRepositoryHook permission denied

Hello together,

I updated Gitea 1.16.8 to 1.18.3 (suse linux 15.3.).
After the update, gitea no longer starts, the following error occurs:

Gitea - Code.SyncRepositoryHooks(ctx) failed: SyncRepositoryHook: unable to pre-remove old hook file ‘/opt/gitea/repositories/giteaadmin/ordirob.git/hooks/pre-receive’ prior to rewriting: remove /opt/gitea/repositories/giteaadmin/ordirob.git/hooks/pre-receive: permission denied

Before the update everything was working fine.
Does anyone have an idea what’s going wrong?

remove /opt/gitea/repositories/giteaadmin/ordirob.git/hooks/pre-receive: permission denied

This error is saying Gitea is not able to modify the files at that location. Make sure that Gitea is running as the right user/group and that those directories are accessible by that user/group.

You may also be running into an issue with MAC like AppArmor or SELinux, you can check their audit logs to see if they’re the reason behind it.

Thanks for your reply Jake.
Gitea works with the right user, the permissions on the directories match.

Meanwhile I did an update to a 1.17.x version. The problem here was now, that new repositories could not be created via the gitea WEB-UI - because of permission denied on the repository directory.
Only with a gitea 1.16.x version do these problems not occur in my environment. I now suspect that something is running on the server that interferes with gitea.

You might be running into the switch from using the gitconfig at $HOME/.gitconfig to a path specified in app.ini which occurred in 1.17.x. See Internal Gitconfig and Config Cheat Sheet. It could also be an issue where an antivirus or other process is scanning files and Gitea tries to access the file at the same time the other process does.

If that’s not it, could you post your scrubbed app.ini and the full debug logs from Gitea starting to the error (set [log] LEVEL=Debug)?
To make it easier to read, you can format it like this to make it show nicely on Discourse.
```
[logs]
```

Thank you for these valuable tips!
I’ll take a look and report back with results. But it can take a while… :wink: