title: how to recover an accidently deleted remote git repository from local repository
body: <p>I've done something like following:</p>
  
  <p>(1) clone a remote git repository to local host</p>
  
  <p>local# <code>git clone http://www.foo.com foo</code></p>
  
  <p>(2) add another project on a ssh host(bar) as the second remote repository</p>
  
  <p>local# <code>git remote add bar ssh://bar/home/project</code></p>
  
  <p>local# <code>git fetch bar</code></p>
  
  <p>(3) done something stupid on the ssh host(bar):</p>
  
  <p>bar# <code>rm -rf /home/project</code></p>
  
  <p>Could you please tell me how can I recover project on the ssh host(bar) from my local copy, so other developer on the ssh host can continue their work, and I can run 'git fetch bar' to get their commit, just like I didn't do anything wrong to their ssh host, i.e. undo all I did to host bar. thanks a lot.</p>
  
  <p>UPDATE:</p>
  
  <p>bar# <code>mkdir -p /home/project &amp;&amp; cd /home/project &amp;&amp; git init --bare</code></p>
  
  <p>local# <code>git branch remote show bar</code></p>
  
  <p>local# <code>git push bar bar/master:refs/heads/master</code></p>
  
  <p>local# <code>git push bar bar/branch1:refs/heads/branch1</code></p>
  
  <p>local# <code>git push bar bar/branch2:refs/heads/branch2</code></p>