title: What user runs the git hook?
body: <p>I have a post-update hook on my server, such that when I </p>
  
  <pre><code>git push
  </code></pre>
  
  <p>it does a pull on the live web directory. However, while the push always succeeds, the post-update hook sometimes fails.</p>
  
  <p>The hook is pretty simple:</p>
  
  <pre><code>#!/bin/sh
  #
  # An example hook script to prepare a packed repository for use over
  # dumb transports.
  #
  # To enable this hook, rename this file to "post-update".
  cd /var/www
  env -i git pull
  </code></pre>
  
  <p>I'm pushing updates from a variety of places, but sometimes I have to login as root on the server and manuall do a </p>
  
  <pre><code>env -i git pull
  </code></pre>
  
  <p>I only have to do it 20% of the time though. Any ideas why it would fail randomly? Also, how would I get it to log error messages, since it might be running as someone who can't write to the file system?</p>