Git hooks don’t seem to follow symlink?

Hi guys,

Recently i’ve been trying to setup a Git central (bare) repository which, on pushed, will ftp-deploy the project to an external server, and for that, git-ftp by ezyang is a great solution.

I’ve done everything according to the documentation, especially the part where it says to symlink the post-receive hook to /path-to-git-ftp/post-receive, but the system keeps ignoring my hook silently.

When I removed the symlink and used an actual post-receive executable script, everything worked as normal. When I hard-linked the post-receive script, everything still worked as expected. When I switched to softlink again, the old problem came back: git non-verbally ignored the hook.

So finally I found out the reason: my git runs under a particular user (not surprisingly, git), which has a very limited shell (again, not surprisingly, git-shell), and for some reason I placed my git-ftp directory under the home directory tree of… another user. I had thought chmod a+x and chmod 777 the script would make it accessible from git, but in fact it doesn’t. Moving the whole git-ftp directory to the home directory of the ‘git’ user solves the problem (of course i also re-linked the hook after moving the folder).

So yeah, given there being no related document on similar cases, it was quite a pleasure sorting this out. Hope this could be of some use to anyone who might run into the same issue I did.

Cheers,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s