Git Hook under Windows Git Hook under Windows windows windows

Git Hook under Windows


I finally got it working!This is really weird. I had to type a pwd to see where actually is the batch being located and it showed the hook location on the server. However, in the next line I added a hostname and it showed me my local hostname.Then I add the whole path just like:

#!/bin/shecho "Starting copy from repository to work tree..."pwdhostnamegit --work-tree=//remotehost/d$/Webseiten/__gitweb --git-dir=//remotehost/d$/_gitrepo.git checkout -fecho "Finished."

I hope this solution works for someone


For a shell script (and those hook scripts will be executed as shell, even in Windows, through the msys layer of msysgit), you could use a different sort of path:

#!/bin/shgit --work-tree=/d/websites/__gitweb --git-dir=/d/_gitrepo.git/ checkout -f

See also other possibilities with "Posix path conversion in MinGW"