git post-receive hook to write files from bare repo to www folder msysgit (windows)

713 Views Asked by At

So I have two windows machines, I'm basically trying to manage some web files with git I have a bare repository on the remote machine, I have a cloned version on the local machine and I have pushed some files to the remote repository.

I want the files to be deployed to the directory c:\UniServer\www\Scripts on the post-receive event here is the contents of my post-receive file:

#!/bin/sh
GIT_WORK_TREE=/c/UniServer/www/Scripts git checkout -f

My repo is stored in c:\repos\scripts.git\ I have set the permissions to c:\repos\scripts.git\hooks\post-receive to +x using chmod and I am using gitstack (http://gitstack.com) to admin the repository.

The problem is the files are not updating on the remote server when I push up a commit locally, is there a way to log what happens in the hook or simply make it work :)

update: the apache server has this error: [Sat Feb 02 20:04:53 2013] [error] [client xx.xx.xxx.xxx] error: cannot spawn hooks/post-receive: No such file or directory. C:\repos\scripts.git\hooks\post-receive does exist which makes me think this is a permissions error

1

There are 1 best solutions below

0
On

I had a the same issue and what resolved the problem for me was getting the GitStack service to run as a local user account rather than Local system. Whichever account you use will need read/write permissions to the repository folder of course, but I'm not sure what other permissions it may need; I just used a local admin account for testing purposes.

hope that helps!