title: Chmod on Git Post-Receive
body: <p>I've just got my first VPS &amp; have set up NGinx, Ruby, Rails &amp; Gitolite.</p>
  
  <p>I can push and pull fine.  However, once I push when I visit the URL I get a <code>403 forbidden</code> error. The files locally are <code>755</code> but it seems Git is not storing those.</p>
  
  <p>I've found a couple of posts discussing this (including this one: <a href="https://stackoverflow.com/questions/6210116/git-deploying-project-file-permissions-chmod">git deploying project - file permissions - (chmod)</a>) and the answer seems to be to add a <code>CHMOD 755</code> to the <code>post-receive</code> hook.</p>
  
  <p>My <code>post-receive</code> currently looks like:</p>
  
  <pre><code>#!/bin/sh
  
  GIT_WORK_TREE=/www/newrails git checkout -f
  chmod 755 -R /www/newrails
  </code></pre>
  
  <p>And I have done <code>chmod +x post-receive</code>.</p>
  
  <p>However when I push I get the error: <code>remote: chmod: changing permissions of /www/newrails: Operation not permitted</code></p>
  
  <p>How can I go about making it work, either through making the <code>chmod</code> in the hook have the permissions to run, or by some other means?</p>