Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git post-receive hook not running

Tags:

git

hook

In order for a Git hook to run, it needs to have permissions set to allow it to be executable. If a hook doesn't seem to be running, check the permissions, and make sure it's executable. If it isn't you can make all hooks executable like this:

chmod ug+x .git/hooks/*

...or if you want to make a single hook (eg. post-receive) executable:

chmod ug+x .git/hooks/post-receive

(Thanks to this post)


I had this problem. I had a typo in my script filename.

post-recieve instead of post-receive


The issue was related to the mounting of the filesystem. The partition was mounted as noexec, and therefore no files could be executed. This caused the hook not to run. I removed the noexec flag and it now works just fine.


Seems GIT will NOT run the post-receive hook if there are no changes to the code base.

In my case,

The post hook was not getting executed, but the "push" operation kept returning the following message.

Everything up-to-date

So I just created an empty file in my code, did commit and then pushed to remote. On which the post-receive hook got executed.


I used MacBook and this helped in my situation:

chmod ug+x .husky/*
chmod ug+x .git/hooks/*