title: Fully fork a git repo?
body: <p>I've not quite managed to piece together what I want to know from the multitude of answers on here and blog posts, so I'm asking this question:</p>
  
  <p>How do I fork a git repo such that I get all the branches &amp; tags of the upstream?</p>
  
  <p>What I've tried is:</p>
  
  <pre><code>git init
  git remote add origin &lt;ORIGIN_URL&gt; # i.e. my repo
  git remote add upstream &lt;UPSTREAM_URL&gt; # i.e. the repo I want to fork
  git fetch upstream
  git push --all origin
  </code></pre>
  
  <p>But that last line fails when I would expect it to work. I get this:</p>
  
  <pre><code>$ git push --all origin
  No refs in common and none specified; doing nothing.
  Perhaps you should specify a branch such as 'master'.
  fatal: The remote end hung up unexpectedly
  error: failed to push some refs to &lt;ORIGIN_URL&gt;
  </code></pre>
  
  <p>Any ideas?</p>
  
  <p>EDIT:</p>
  
  <p>Maybe you can think of this question as "What does GitHub actually do when you click the fork button?", as that's the behaviour I am trying to replicate.</p>