title: push from bare git repository
body: <p>I am trying to use a bare git repo as a bridge between my working repo and the origin</p>
  
  <pre><code>origin ----- bare repo ----- working repo
  </code></pre>
  
  <p>I can go into the working repo and push and pull from the bare repo. But I also need to go into the bare repo and push and pull form the origin, is that possible?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>What I've tried so far...</p>
  
  <p>To create the bare repo</p>
  
  <pre><code>mkdir bare_repo
  cd bare_repo
  git init --bare
  git remote add origin path_to_origin
  git fetch origin
  </code></pre>
  
  <p>To create the working repo</p>
  
  <pre><code>git clone path_to_bare
  </code></pre>
  
  <p>I get a warning: "remote HEAD refers to nonexistant ref, unable to checkout", but it still creates the working repo</p>
  
  <pre><code>git pull origin master
  </code></pre>
  
  <p>I get an error: "Couldnt find remote ref master"</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Turns out I had a write permissions issue, and so I couldn't push from the working repo to the bare repo. So I general I need to check permissions for all my repo locations before asking questions... Now everything is working...</p>
  
  <p>One things is, if someone else pushes a commit to the origin, I will need to fetch that commit from my bare repo and update the branch on my bare repo. The fetch is simple enough</p>
  
  <pre><code># in bare repo
  git fetch origin master
  </code></pre>
  
  <p>but I dont know the best way to update the branch. I cant pull because there is no working directory. I can get the hash of the new commit using</p>
  
  <pre><code>git ls-remote
  </code></pre>
  
  <p>and then manually point the branch to it with</p>
  
  <pre><code>git branch -f master &lt;hash&gt;
  </code></pre>
  
  <p>But it seems like there would be a better way.</p>
  
  <p>But I think that should be a separate question.</p>