title: Make a git deployment owned by www-data
body: <p>My <code>post-receive</code> hook deploys to <code>/home/repo</code>, where my Apache virtual host is pointing.
  I would like <code>/home/repo</code> to be owned by <code>www-data</code>.</p>
  
  <p>Should I add <code>git</code> to <code>/etc/sudoers</code> and allow it to execute a custom script that make <code>chown -R www-data:www-data /home/repo</code> as <code>root</code> after each pushing ? <code>git</code> don't seem to be able to do it as himself. Seems pretty insecure though.</p>
  
  <p><strong>Edit</strong>:
  <code>post-receive</code> is doing a <code>git checkout -f</code> and <code>chmod -R 750 /home/repo</code> under <code>git</code> user. I just leave <code>git</code> own <code>/home/repo</code> and added <code>www-data</code> (or any Apache user) to the <code>git</code> group so it can read it.</p>