apfelschnitz apfelschnitz - 2 months ago 18
Git Question

Git post-recieve not running on windows

I'm trying to get a push-to-deploy workflow running with git in our local network. To get started I created the following repositories on my local machine (Windows 7):

  • D:/gitTest/remote/test-01.git (bare repository)

  • D:/gitTest/local/test-01 (working repository)

When I push to the remote repository I want it to deploy into the folder:

  • D:/gitTest/remote/test-01_live

Push and pull between the local and the remote repository work fine and a local pre-push hook (just a echo) gets called.

But the post-recieve hook in the remote repository is not running.

The file test-01.git/hooks/post-recieve contains:

echo "Script started"
git --work-tree=/d/gitTest/remote/test-01_live --git-dir=/d/gitTest/remote/test-01.git checkout -f
echo "Script ended"

If I run the file manually via the git bash it works fine. Also tried (with the same result):

GIT_WORK_TREE=/d/gitTest/remote/test-01_live git checkout -f

Is the post-recieve hook triggered if I push to a bare repository on a local machine? Or do the so called "server hooks" actually need a git server?
Any other ideas why the hook is not triggered?



The name of the hook and the file must be post-receive not post-recieve.