title: Executing python subprocess via git hook
body: <p>I'm running Gitolite over the Git repository and I have post-receive hook there written in Python. I need to execute "git" command at git repository directory. There are few lines of code:</p>
  
  <pre><code>proc = subprocess.Popen(['git', 'log', '-n1'], cwd='/home/git/repos/testing.git' stdout=subprocess.PIPE, stderr=subprocess.PIPE)
  proc.communicate()
  </code></pre>
  
  <p>After I make new commit and push to repository, scripts executes and says</p>
  
  <pre><code>fatal: Not a git repository: '.'
  </code></pre>
  
  <p>If I run</p>
  
  <pre><code>proc = subprocess.Popen(['pwd'], cwd='/home/git/repos/testing.git' stdout=subprocess.PIPE, stderr=subprocess.PIPE)
  </code></pre>
  
  <p>it says, as expected, correct path to git repository (/home/git/repos/testing.git)</p>
  
  <p>If I run this script manually from bash, it works correct and show correct output of "git log". What I'm doing wrong?</p>