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

相关文章
相关标签/搜索