2014-02-07 76 views
0

我做git push時遇到這個錯誤https://stackoverflow.com/a/20884273/45603撤消「混帳遠程RM起源」

谷歌使我這個帖子:https://stackoverflow.com/a/20871910/45603

所以,我跑了之後git remote add origin '[email protected]:username/repo.git'

現在git remote rm origin我收到以下消息時,我做了git push

fatal: The current branch master has no upstream branch. 
To push the current branch and set the remote as upstream, use 

    git push --set-upstream origin master 

我想撤消git remote rm origin和回滾與git 1.8.4。

如何恢復git remote rm origin

編輯:運行git push --set-upstream origin master(由混帳作爲決定)給了我以下錯誤:

ssh: connect to host usts.visualstudio.com 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. 
+0

可能重複[Git SSH錯誤:「連接到主機:錯誤的文件編號」](http://stackoverflow.com/questions/7144811/git-ssh-error-connect-to-host-bad-file-號碼) –

回答

0

你不能 「撤消」 一個git remote rm電話。另外,您不需要撤消git rm。按照指示運行命令。

或者只是運行git push origin master(或其他任何分支)。

0

要解決這個問題,你需要告訴git你的本地主分支跟蹤遠程分支,這是錯誤告訴你要做的事情。通過運行git push --set-upstream origin master,您告訴git當前分支跟蹤原點/主設備

1

git remote rm origin刪除到遠程服務器的連接。 git remote add origin <user>@<url>將重新創建此連接。它看起來好像當你運行git remote add origin <user>@<url>時輸入了錯誤的URL或錯誤的用戶名。也許只是一個錯字。

檢查,運行git remote -v。這將顯示當前配置的遠程存儲庫的連接字符串。根據Visual Studio Online提供的文檔進行檢查。如果是錯誤的,只需再次輸入git remote rm origin,然後再輸入git remote add origin <user>@<url>並輸入正確的詳細信息。

如果您不確定我的意思,或者您已經嘗試過,並且無法正常工作,請發佈您正在使用的確切命令以及git remote -v的確切輸出,我會看看是否可以找到該錯誤。

+0

有沒有辦法向你私下發送確切的命令? –

+0

嗨,對不起,我沒有看到這2天前。你可以發佈命令,但用戶名改變了嗎? – naomi