# Reset pre-receive hooks

**URL:** <https://forum.gitea.com/t/reset-pre-receive-hooks/1865>\
**Category:** Install/Maintain/Configure\
**Created:** [January 31, 2020, 2:58am UTC](https://forum.gitea.com/t/reset-pre-receive-hooks/1865 "2020-01-31T02:58:55Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Akito](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/akito/32/4774_2.png) [@Akito](https://forum.gitea.com/u/Akito)\
**Post date:** [January 31, 2020, 2:58am UTC](https://forum.gitea.com/t/reset-pre-receive-hooks/1865/1 "2020-01-31T02:58:55Z")

</div>

Running

```auto
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

```bash
#!/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.

---

<div class="post-metadata">

**Author:** ![jolheiser](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/jolheiser/32/4807_2.png) [@jolheiser](https://forum.gitea.com/u/jolheiser)\
**Post date:** [January 31, 2020, 3:33am UTC](https://forum.gitea.com/t/reset-pre-receive-hooks/1865/2 "2020-01-31T03:33:52Z")

</div>

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.`

---

<div class="post-metadata">

**Author:** ![Akito](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/akito/32/4774_2.png) [@Akito](https://forum.gitea.com/u/Akito)\
**Post date:** [January 31, 2020, 3:34am UTC](https://forum.gitea.com/t/reset-pre-receive-hooks/1865/3 "2020-01-31T03:34:57Z")

</div>

> [@jolheiser](#):
>
> Resynchronize pre-receive, update and post-receive hooks of all repositories.

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.

---

<div class="post-metadata">

**Author:** ![jolheiser](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/jolheiser/32/4807_2.png) [@jolheiser](https://forum.gitea.com/u/jolheiser)\
**Post date:** [January 31, 2020, 3:40am UTC](https://forum.gitea.com/t/reset-pre-receive-hooks/1865/4 "2020-01-31T03:40:08Z")

</div>

This page?

 ![Screenshot from 2020-01-30 21-39-40](https://us1.discourse-cdn.com/flex020/uploads/gitea/original/1X/6e739726d244379d8e30a6d2f9d29bf089d3b1a5.png)

---

<div class="post-metadata">

**Author:** ![Akito](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/akito/32/4774_2.png) [@Akito](https://forum.gitea.com/u/Akito)\
**Post date:** [January 31, 2020, 12:45pm UTC](https://forum.gitea.com/t/reset-pre-receive-hooks/1865/5 "2020-01-31T12:45:13Z")

</div>

You indeed prove more than well, that it definitely was not the best idea to attempt fixing my Gitea migration past 4am. 😒  
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. 😃

---

<div class="post-metadata">

**Author:** ![jolheiser](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/jolheiser/32/4807_2.png) [@jolheiser](https://forum.gitea.com/u/jolheiser)\
**Post date:** [January 31, 2020, 2:52pm UTC](https://forum.gitea.com/t/reset-pre-receive-hooks/1865/6 "2020-01-31T14:52:13Z")

</div>

Haha no problem at all, happy to help. 😄
