Reset pre-receive hooks


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…


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"

This is more of a workaround, but it works flawlessly.

You can either run gitea admin regenerate hooks or log into the site admin page and run Resynchronize pre-receive, update and post-receive hooks of all repositories.

1 Like

Didn’t find this in the newest master. I thought the UI was reworked, as it wasn’t to be found where it usually resided.

This page?

1 Like

You indeed prove more than well, that it definitely was not the best idea to attempt fixing my Gitea migration past 4am. :unamused:
I actually ignored the Dashboard and headed straight to Monitoring, not finding what I expected. Guess I had it remembered the wrong way.

Thanks for the information though, you were helpful. :smiley:

Haha no problem at all, happy to help. :smile:

1 Like