How to work a git hook


#1

Hi to all,

I have problem with Git Hooks is not working.

My Gogs Version: 0.10.18.0313

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?


#2

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


#3

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.


#4

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


#5

HI.

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


#6

everything output from hook file goes to client side.


#7

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


#8

Git client side.

You should see content from echo during the git push.


#9

Hi,

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?


#10

You’re right, this is a bug, I’ve created an issue for this: https://github.com/gogits/gogs/issues/4338


#11

Hi,

When you plan release 0.12 version?


#12

Not sure… maybe July…


#13

Hi,

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

Than you in advance.