GitHub上傳不了的解決 ssh: connect to host github.com port 22: Bad file number git did not exit cleanly (exi

問題狀況

原本一直用的是github的客戶端,結果如今上傳的時候出問題了,去網站上看,新項目已經建立,可是代碼卻怎麼都上傳不上去。因而只好用命令行的方式解決。git

Tortoisegit上是這樣說的:github

git.exe push -v --progress "xx" master:master

Pushing to git@github.com:xxx/xxxx.git
ssh: connect to host github.com port 22: Bad file number
fatal: Could not read from remote repository.

git did not exit cleanly (exit code 128)

gitbash上是這樣說的shell

$ git status
On branch master
Your branch is based on 'origin/master', but the upstream is gone.
  (use "git branch --unset-upstream" to fixup)

嘗試解決

經過查詢,發如今bash中本身沒有受權key,因而按照教程,查詢現有的密鑰:bash

ls -al ~/.ssh
clip < ~/.ssh/id_rsa.pub

將現有的id_rsa加入到github網站上,並按照github的官網給的教程,將原有的id_rsa加入到本機的ssh:ssh

eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa

可是運行ssh -T git@github.com命令仍是顯示ssh: connect to host github.com port 22: Bad file numberide

仍是沒有解決,而後在官網的常見問題中看到了BadFileNumber,有三種方法,1是用https,2是關於防火牆的,看起來比較麻煩,不想弄;3就是用ssh而非https
而我如今用的好像就是https啊,因而再試着用TortoiseGit試一下,仍是不行。
那就用第三種方法吧,在~/.ssh/config文件中增長,可是看看只有config file而沒有Config,因而就拷貝一個重命名爲config,把下面的代碼粘貼:網站

Host github.com
  Hostname ssh.github.com
  Port 443

就能出現下面的成功受權提示啦~~~命令行

The authenticity of host '[ssh.github.com]:443 ([192.30.253.123]:443)' can't be established.
RSA key fingerprint is .
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '[ssh.github.com]:443,[192.30.253.123]:443' (RSA) to the list of known hosts.
Hi ! You've successfully authenticated, but GitHub does not provide shell access.

再去push看看,終於成功啦啦啦啦code

相關文章
相關標籤/搜索