Running
find . -name "gitea" | grep "/hooks/pre-receive.d/" | xargs cat
in the Gitea source directory showed me that pre-receive hooks are created with the corresponding Gitea installation paths once, and then never updated again, even if you change Gitea’s location, etc.
How do I safely remove or let the hooks update to the current paths? I cannot push an important repository at this moment, because it declines the application of the pre-receive hook due to the wrong years old location in it. I don’t even really need these hooks, as far as I know…
Solution
#!/bin/bash
for f in $(find . -name "gitea"); do
sed -in "s|/old/path/to/gitea/binary|/new/path/to/gitea/binary|" "$f"
sed -in "s|--config='/old/path/to/gitea/app.ini'|--config='/new/path/to/gitea/app.ini'|" "$f"
done
This is more of a workaround, but it works flawlessly.