title: executing a git pull from a different directory
body: <p>I'm configuring <a href="https://github.com/guillaumebort/calimoucho" rel="noreferrer">calimoucho</a> (a little play continuos integration server), and for it to work I need to run a command to pull a cloned git hub repository from outside it.</p>
  
  <p>to be more precise, I'll explain it with an example.</p>
  
  <p>I have the following repository</p>
  
  <pre><code>cd /home/sas
  mkdir apps
  cd apps
  mkdir myApp
  cd myApp
  git init
  echo "my file" &gt; file
  git add .
  git commit -m "initial commit"
  </code></pre>
  
  <p>Just a silly test repository where my app is supossed to be</p>
  
  <p>Now I need to clone that repository to a checkout folder. </p>
  
  <pre><code>cd /home/sas
  mkdir calimoucho
  cd calimoucho
  mkdir checkout
  cd checkout
  git clone /home/sas/apps/myApp/ 
  </code></pre>
  
  <p>so I have the following directory structure</p>
  
  <pre><code>~/apps
      myapp
        .git
        file
  ~/calimoucho
      checkout
        myapp
          .git
          file
  </code></pre>
  
  <p>The continuos integration server will have to pull new changes from ~/apps/myapp to ~/calimoucho/checkout/myapp, running a command line sentence from ~/calimoucho</p>
  
  <p>I try with the following command</p>
  
  <pre><code>~/calimoucho$ git --git-dir=/home/sas/apps/myApp/.git --work-tree=/home/sas/calimoucho/checkout/myApp/ pull
  </code></pre>
  
  <p>and I get the following error</p>
  
  <pre><code>fatal: /usr/lib/git-core/git-pull cannot be used without a working tree.
  </code></pre>
  
  <p>if I don't specify the --work-tree option, the pull is issued, but changes are applied to ~/calimoucho folder instead of ~/calimoucho/checkout/myApp</p>
  
  <p>any idea how to update the cloned repo from the ~/calimoucho folder?</p>
  
  <p>thanks a lot</p>