title: Fatal: this operation must be run in a work tree - but it is
body: <p>I'm actively developing working on a repo and want to add a github pre-commit hook - my first.</p>
  <p>When I cd into the <code>/.git</code> directory I get the error <code>fatal: this operation must be run in a work tree</code></p>
  <p>I have tried:</p>
  <ol>
  <li>Checking out the branch again</li>
  <li>Running <code>git init</code> again</li>
  <li>Setting the <code>GIT_WORK_TREE</code> env var (and <code>echo $GIT_WORK_TREE</code> to ensure it's set)</li>
  <li>running <code>git --work-tree=. checkout branch</code> and <code>git --work-tree=${PWD} checkout branch</code></li>
  <li><code>rm -rf</code> and cloning again</li>
  </ol>
  <p>Any suggestions?
  I am using zsh on MacOS Monterey btw and I am also using Sourcetree to manage the repo sometimes.</p>
  <p>Thank you</p>