title: Git push error: Unable to unlink old (Permission denied)
body: <p>In the remote server I have a post-receive hook set up in order to make a git checkout of my repository:</p>
  
  <pre><code>#!/bin/sh
  GIT_WORK_TREE=/var/www/&lt;website&gt; git checkout -f
  </code></pre>
  
  <p>But when I make a push from my local machine to the git repository in the server, I get the following error messages:</p>
  
  <pre><code>remote: error: unable to unlink old '&lt;file&gt;' (Permission denied)
  </code></pre>
  
  <p>This appears many times over, one error message for almost every file.</p>
  
  <p>However I have a README.txt file that I'm able to change using git, here are its permissions:</p>
  
  <pre><code>-rw-r--r--  1 &lt;serverusername&gt;  &lt;serverusername&gt;  2939 Aug  2 10:58 README.txt
  </code></pre>
  
  <p>But other files with exactly the same owner and same permissions, give me that error.</p>
  
  <p>In another local repository for another website, I have the files with my local machine username as owner, and when I push to the remote server it respects the remote server owner of the files and works like a charm.</p>
  
  <p>Obviously it seems a permissions related error, but I can't find a way to fix it, any suggestions?</p>