2013-03-29 4 views
6

schob ich einen Zweig in einen leeren GitHub Repo:vollständig ersetzen Fern Zweig mit einem anderen in Github so dass keine Spuren der alten

[email protected] /c/Dropbox/eclipse_workspaces/javaEE/ted2012 (GitHubSquash) 
$ git remote add github https://github.com/Utumno/ted2012.git 
[email protected] /c/Dropbox/eclipse_workspaces/javaEE/ted2012 (GitHubSquash) 
$ git push -u github GitHubSquash 
Username for 'https://github.com': Utumno 
Password for 'https://[email protected]': 
//... 
To https://github.com/Utumno/ted2012.git 
* [new branch]  GitHubSquash -> GitHubSquash 
Branch GitHubSquash set up to track remote branch GitHubSquash from github. 

Dann bemerkte ich, ich entlang etwas Flaum geschoben hatte, und versuchte, den Zweig zu löschen/ersetzen sie es mit einem anderen usw. ich schlug fehl:

[email protected] /c/Dropbox/eclipse_workspaces/javaEE/ted2012 (GitHub2) 
$ git push :github && 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. 
[email protected] /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) 
[email protected] /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. 
[email protected] /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. 

ich das Repo zu löschen hatte und von neuem meine Niederlassung schieben. Das funktionierte aber ließ mich fragen:

  1. Was habe ich tun soll, um vollständig den Remote-Zweig mit andere zu ersetzen?

  2. Warum auf der Erde war ich den ssh bekommen: connect Port 22 Gastgeber: Bad Dateinummer Fehler - während meine erste Push erfolgreich war (und bemerke ich bin auf http)?

    $ git --version 
    git version 1.8.1.msysgit.1 
    

Antwort

15

Ihre Syntax ist falsch. Der korrekte Befehl ist:

git push -f github GitHubSquash 

Dies wird den Remote-GitHubSquash-Zweig mit Ihrer lokalen Version ersetzen. Wenn Sie nur die Remote-Zweig löschen möchten:

git push -f github :GitHubSquash 

Ich denke, Sie Ihre Fehlermeldung anzeigt, weil git versucht :github als URL zu interpretieren und seltsame Dinge passiert :).

0
git push origin :GitHubSquash 

entfernten Zweig löschen

git push --set-upstream origin GitHubSquash 

lokale Niederlassung schieben

Verwandte Themen