title: Git Hook under Windows
body: <p>I have the following code to checkout in a working directory in the hook post-receive:</p>
  
  <pre><code>#!/bin/sh
  git --work-tree=d:/websites/__gitweb --git-dir=d:/_gitrepo.git/ checkout -f
  </code></pre>
  
  <p>Unfortunately it doesn't seem to work. However, the command does work when I enter just this in the windows command line (cms):</p>
  
  <pre><code>git --work-tree=d:/websites/__gitweb --git-dir=d:/_gitrepo.git/ checkout -f
  </code></pre>
  
  <p>I have checked the permissions and the executing attributes but nothing.</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>I think I'm getting closer. Now I know what the problem is but I don't know why is this happening. The hook is actually being triggered but I receive this message:</p>
  
  <pre><code>remote: Starting copy from repository to work tree...
  remote: fatal: Not a git repository: 'd:/_gitrepo.git/'
  remote: Finished.
  </code></pre>
  
  <p>I have tried to change the path of d: to the whole network path but it still doesn't work. If I go to the remote repository and I do a git log, the changes are there and if I run the hook with sh, it works.
  Why is it saying that it is not a git repository when clearly it is?</p>