title: Completely replace remote branch with another in github leaving no traces of the old one
body: <p>I pushed a branch to an empty github repo :</p>
  
  <pre><code>MrD@MRSD /c/Dropbox/eclipse_workspaces/javaEE/ted2012 (GitHubSquash)
  $ git remote add github  https://github.com/Utumno/ted2012.git
  MrD@MRSD /c/Dropbox/eclipse_workspaces/javaEE/ted2012 (GitHubSquash)
  $ git push -u github GitHubSquash
  Username for 'https://github.com': Utumno
  Password for 'https://Utumno@github.com':
  //...
  To https://github.com/Utumno/ted2012.git
   * [new branch]      GitHubSquash -&gt; GitHubSquash
  Branch GitHubSquash set up to track remote branch GitHubSquash from github.
  </code></pre>
  
  <p>Then I noticed I had pushed some fluff along and tried to delete the branch/replace it with another etc. I failed :</p>
  
  <pre><code>MrD@MRSD /c/Dropbox/eclipse_workspaces/javaEE/ted2012 (GitHub2)
  $ git push  :github &amp;&amp; git push github GitHub2
  ssh: connect to host  port 22: Bad file number
  fatal: Could not read from remote repository.
  
  Please make sure you have the correct access rights
  and the repository exists.
  MrD@MRSD /c/Dropbox/eclipse_workspaces/javaEE/ted2012 (GitHub2)
  $ git checkout GitHubSquash
  Switched to branch 'GitHubSquash'
  Your branch is ahead of 'github/GitHubSquash' by 1 commit.
    (use "git push" to publish your local commits)
  MrD@MRSD /c/Dropbox/eclipse_workspaces/javaEE/ted2012 (GitHubSquash)
  $ git push  :github
  ssh: connect to host  port 22: Bad file number
  fatal: Could not read from remote repository.
  
  Please make sure you have the correct access rights
  and the repository exists.
  MrD@MRSD /c/Dropbox/eclipse_workspaces/javaEE/ted2012 (GitHubSquash)
  $ git push  -u :github
  ssh: connect to host  port 22: Bad file number
  fatal: Could not read from remote repository.
  
  Please make sure you have the correct access rights
  and the repository exists.
  </code></pre>
  
  <p>I had to delete the repo and push my new branch anew. That worked but left me wondering :</p>
  
  <ol>
  <li><p>What should I have done to completely replace the remote branch with
  another ? </p></li>
  <li><p><em>Why on earth I was getting the ssh: connect to host  port
  22: Bad file number</em> errors - while my first push succeeded (and notice I am on http) ?</p>
  
  <pre><code>$ git --version
  git version 1.8.1.msysgit.1
  </code></pre></li>
  </ol>