Skip to content

Setting Global pre receive hook in gitea using docker #34485

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
VinothKumar-Ganesan opened this issue May 16, 2025 · 5 comments
Open

Setting Global pre receive hook in gitea using docker #34485

VinothKumar-Ganesan opened this issue May 16, 2025 · 5 comments
Labels
issue/not-a-bug The reported issue is the intended behavior or the problem is not inside Gitea

Comments

@VinothKumar-Ganesan
Copy link

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

@lunny
Copy link
Member

lunny commented May 16, 2025

I don't think Gitea supports that feature.

@lunny lunny added issue/not-a-bug The reported issue is the intended behavior or the problem is not inside Gitea and removed type/bug labels May 16, 2025
@kalirajanganeshan
Copy link

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

@lunny
Copy link
Member

lunny commented 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.

@kalirajanganeshan
Copy link

@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

@lunny
Copy link
Member

lunny commented 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 up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue/not-a-bug The reported issue is the intended behavior or the problem is not inside Gitea
Projects
None yet
Development

No branches or pull requests

3 participants