How to work a git hook


Hi to all,

I have problem with Git Hooks is not working.

My Gogs Version:

I set git hook

Hook file is created on file system:

suoders is configured correctly from gogs user context command runs and I see in logs that event is run. But when I do commit from web UI nothing happens.

I try check logs in /var/log/gogs folder but couldn’t find anything that could help me :frowning:

Can some one advice where is my mistake?


I don’t think you can sudo to root like that (unless root is passwordless, and even so).


Yes it is possible if put config lines in /etc/suoders file. As I said I tested from gogs user it runs. But after commit hook not working.


To make sure hook is executed, you can try echo "hello" first, then try other things.



Yes I add as you recommended echo "Test" and where I should look? In which log file? I couldn’t find.


everything output from hook file goes to client side.


So I understand client is WEB UI, so with this logic it should display on web page?


Git client side.

You should see content from echo during the git push.



I tested with git client cli.

But when I do commit from WEB UI I didn’t see any event run. So maybe WEB UI works little bit different? I mean it modifies GIT repo directly not using git it self? Or maybe should be used some different git hook?


You’re right, this is a bug, I’ve created an issue for this:



When you plan release 0.12 version?


Not sure… maybe July…



When you plan fix this issue? Almost 6 month this is known.

Than you in advance.