title: git with --git-dir= results in 'not a git repository'
body: <p>I have a script in one of my iOS apps that should get the git revision hash and put it in the version number. In this script I run git --git-dir=&quot;$PROJECT_DIR&quot; show -s --pretty=format:%h for that. However, I get the message that the directory isn't a git repository. If I echo the PROJECT_DIR var and go to the terminal the following works:</p>
  <pre><code>cd projectDirPath
  git show -s --pretty=format:%h
  </code></pre>
  <p>What doesn't work is:</p>
  <pre><code>git --git-dir=projectDirPath show -s --pretty=format:%h
  </code></pre>
  <p>Am I missing something? The documentation states, that I can specify the path to a git repository with --git-dir and the specified path obviously is a git repository as all the git commands work without any problem if I first cd into that path. However if I am not in this path, specifing --git-dir doesn't work.</p>