Setting Global pre receive hook in gitea using docker #14502

Open
opened 2025-11-02 11:14:39 -06:00 by GiteaMirror · 5 comments
Owner

Originally created by @VinothKumar-Ganesan on GitHub (May 16, 2025).

Description

we are currently facing issue where we created the required hooks in the custom/hooks/pre-receive.d but it was not working as expected

Gitea Version

1.23.8

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

docker

Database

PostgreSQL

Originally created by @VinothKumar-Ganesan on GitHub (May 16, 2025). ### Description we are currently facing issue where we created the required hooks in the custom/hooks/pre-receive.d but it was not working as expected ### Gitea Version 1.23.8 ### Can you reproduce the bug on the Gitea demo site? No ### Log Gist _No response_ ### Screenshots _No response_ ### Git Version _No response_ ### Operating System _No response_ ### How are you running Gitea? docker ### Database PostgreSQL
GiteaMirror added the issue/not-a-bug label 2025-11-02 11:14:39 -06:00
Author
Owner

@lunny commented on GitHub (May 16, 2025):

I don't think Gitea supports that feature.

@lunny commented on GitHub (May 16, 2025): I don't think Gitea supports that feature.
Author
Owner

@kalirajanganeshan commented on GitHub (May 18, 2025):

Hi @lunny We have pre receive hook need to replace in individual repository hook folder. Gitea documents suggestion if we run the Resynchronize hook action in admin page will do that action, but it won't work for we get below auto generated hook only. We are asking which folder need to maintain my hook to replace all repository prehooks by running Resynchronize hook action

#!/usr/bin/env bash

AUTO GENERATED BY GITEA, DO NOT MODIFY

/usr/local/bin/gitea hook --config=/data/gitea/conf/app.ini pre-receive

@kalirajanganeshan commented on GitHub (May 18, 2025): Hi @lunny We have pre receive hook need to replace in individual repository hook folder. Gitea documents suggestion if we run the Resynchronize hook action in admin page will do that action, but it won't work for we get below auto generated hook only. We are asking which folder need to maintain my hook to replace all repository prehooks by running Resynchronize hook action #!/usr/bin/env bash # AUTO GENERATED BY GITEA, DO NOT MODIFY /usr/local/bin/gitea hook --config=/data/gitea/conf/app.ini pre-receive
Author
Owner

@lunny commented on GitHub (May 18, 2025):

Do you mean you need to put your customized hook scripts to every repository? There is no such feature. You can put the hooks under hooks/pre-receive.d/your_script and don't override the gitea one.

@lunny commented on GitHub (May 18, 2025): Do you mean you need to put your customized hook scripts to every repository? There is no such feature. You can put the hooks under `hooks/pre-receive.d/your_script` and don't override the `gitea` one.
Author
Owner

@kalirajanganeshan commented on GitHub (May 19, 2025):

@lunny We have put my pre receive custom hook script in the repository hook folder but it wont work and it work if my changes exist on gitea file alone. My requirement is simple we can't create the new branch in the name of matching with protected branch pattern from protected branch failed with below error.

For example: My branch protection pattern as private/* and can't create branch in the name of "private/kali"

Image

For avid this issue we have wrote the custom hook and those hook need to run for all repositories. Is Gitea have Global webhook support. Also share the clear guidance how to use pre receive hook or else share any other idea to overcome that issue

@kalirajanganeshan commented on GitHub (May 19, 2025): @lunny We have put my pre receive custom hook script in the repository hook folder but it wont work and it work if my changes exist on gitea file alone. My requirement is simple we can't create the new branch in the name of matching with protected branch pattern from protected branch failed with below error. For example: My branch protection pattern as **private/*** and can't create branch in the name of **"private/kali"** ![Image](https://github.com/user-attachments/assets/8f9675c9-71dc-45f8-9497-bb17e1cc764e) For avid this issue we have wrote the custom hook and those hook need to run for all repositories. Is Gitea have Global webhook support. Also share the clear guidance how to use pre receive hook or else share any other idea to overcome that issue
Author
Owner

@lunny commented on GitHub (May 20, 2025):

Looks like your protected branch rules prevent to push commits to such branch directly. You can change the protected branch rules.

@lunny commented on GitHub (May 20, 2025): Looks like your protected branch rules prevent to push commits to such branch directly. You can change the protected branch rules.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#14502