title: How do I get my files uploaded with post-receive?
body: <p>I have the following shell script as <code>post-receive</code> hook, which should copy my working copy into my <code>/mnt/repo/</code> folder:</p>
  
  <pre class="lang-sh prettyprint-override"><code>#!/bin/sh
  rm -rf /tmp/repo/
  rm -rf /mnt/repo/*
  
  mkdir /tmp/repo/ &amp;&amp; cd /tmp/repo/
  
  git init
  git remote add origin file:///home/git/repos/repo.git
  git fetch
  git checkout development
  
  cp -r /tmp/repo/* /mnt/repo/
  </code></pre>
  
  <p>If I run it locally, it works just fine. However, if it is run by Git after pushing, it won't work, and I get the following output in my local Git Bash:</p>
  
  <pre class="lang-sh prettyprint-override"><code>$ git push local development
  git@192.168.178.88's password:
  Counting objects: 6, done.
  Delta compression using up to 4 threads.
  Compressing objects: 100% (3/3), done.
  Writing objects: 100% (3/3), 349 bytes | 0 bytes/s, done.
  Total 3 (delta 2), reused 0 (delta 0)
  remote: Initialized empty Git repository in /tmp/repo/
  remote: From file:///home/git/repos/repo
  remote:  * [new branch]      development -&gt; origin/development
  remote:  * [new branch]      release    -&gt; origin/release
  remote: fatal: This operation must be run in a work tree
  To git@192.168.178.88:repos/repo.git
     01568cc..ee31229  development -&gt; development
  </code></pre>
  
  <p>Moreover, in my <code>/tmp/repo</code> and <code>/mnt/repo</code> folders, I have the following folder structure:</p>
  
  <pre><code>drwxr-xr-x  7 git  git  220 Mar 14 13:47 .
  drwxrwxrwt  3 root root  60 Mar 14 13:47 ..
  drwxr-xr-x  2 git  git   40 Mar 14 13:47 branches
  -rw-r--r--  1 git  git  183 Mar 14 13:47 config
  -rw-r--r--  1 git  git   73 Mar 14 13:47 description
  -rw-r--r--  1 git  git  240 Mar 14 13:47 FETCH_HEAD
  -rw-r--r--  1 git  git   23 Mar 14 13:47 HEAD
  drwxr-xr-x  2 git  git  200 Mar 14 13:47 hooks
  drwxr-xr-x  2 git  git   60 Mar 14 13:47 info
  drwxr-xr-x 44 git  git  880 Mar 14 13:47 objects
  drwxr-xr-x  5 git  git  100 Mar 14 13:47 refs
  </code></pre>