title: Git post-receive hook clone successful, but reporting 'not a git repository'?
body: <p>I have a <code>post-receive</code> hook inside a Git repository that clones the repository into another directory and then <code>cd</code>s into that directory.</p>
  
  <pre><code>#!/bin/bash --login
  
  GIT_REPO="$HOME/oliverjash.me.git"
  
  source "$HOME/.bash_profile"
  
  checkout () {
    BRANCH="$1"
    TMP_GIT_CLONE="$2"
  
    git clone $GIT_REPO $TMP_GIT_CLONE
    cd $TMP_GIT_CLONE
    git status
  }
  
  checkout master "$HOME/tmp/oliverjash.me"
  checkout project "$HOME/tmp/project.oliverjash.me"
  
  exit
  </code></pre>
  
  <p>If I run this script whilst logged in to SSH, <code>git status</code> works fine. However, when the script is executed as the <code>post-receive</code> hook, <code>git status</code> reports this:</p>
  
  <pre><code>remote: fatal: Not a git repository: '.'
  </code></pre>
  
  <p>I can't understand why this is!</p>