问题情况

本来一直用的是github的客户端,结果现在上传的时候出问题了,去网站上看,新项目已经创建,但是代码却怎么都上传不上去。于是只好用命令行的方式解决。

Tortoisegit上是这样说的:

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上是这样说的

$ 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,于是按照教程,查询现有的密钥:

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

将现有的id_rsa加入到github网站上,并按照github的官网给的教程,将原有的id_rsa加入到本机的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 number

还是没有解决,然后在官网的常见问题中看到了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看看,终于成功啦啦啦啦

GitHub上传不了的解决 ssh: connect to host github.com port 22: Bad file number git did not exit cleanly (exit code 128)的更多相关文章

  1. ssh: connect to host gihub.com port 22: Connection timed out

    方案1(本人使用此方案,问题得已解决): 可能是ssh-server未安装或者未启动.我的ubuntu 12.04 默认只安装了openssh-client,并没有安装server. 运行 ps -e ...

  2. ssh: connect to host github.com port 22: Connection timed out

    问题描述 $ git clone git@github.com:MaugerWu/MaugerWu.github.io.git Cloning into 'MaugerWu.github.io'... ...

  3. git clone遇到的[ssh: connect to host github.com port 22]

    起因 在学习递归的时候,对汉诺塔小研究了一番,参考网上写了个demo,后面就想同步到github. 过程 这台电脑是新电脑,所以需要先本地生成ssh key:ssh-keygen -t rsa -C ...

  4. github连接报"ssh: connect to host github.com port 22: Connection timed out"错误

    1. 异常 在连接github时,执行"ssh -T git@github.com" 命令时,出现 ssh: connect to host github.com port 22: ...

  5. github默认端口22被占用,ssh: connect to host github.com port 22: Connection timed out

    出现github 连接错误: ssh:connect to host github.com port 22:Connection timed out 刚开始以为是网络问题,github不能连接上,但是 ...

  6. 关于github报错:ssh: connect to host github.com port 22: Connection timed outfatal: Could not read from remote repository.Please make sure you have the correct access rightsand the repository exists.

    当执行git命令如:git clone.git pull等等 出现报错:ssh: connect to host github.com port 22: Connection timed outfat ...

  7. ssh: connect to host github.com port 22: Connection refused

    假设git例如,下面的问题时,远程推送: [fulinux@ubuntu learngit]$ git push -u origin master ssh: connect to host githu ...

  8. Github拉取远端的时候提示“ssh: connect to host github.com port 22: Connection timed out”错误

    在使用Github的时候,如果使用到拉取远端分支的时候或者测试ssh -T git@github.com的时候可能会出现连接失败的问题,错误描述为“ssh: connect to host githu ...

  9. 关于github报错 ssh: connect to host github.com port 22: Connection timed out fatal: Could not read from remote repository.

    今天上午写demo的时候,突然pull不下代码了,报了一下这样情况的错误: 看了一下代码,怀疑是网路错误,因为在这以前一切都正常的,然后将代码复制搜索了一番,解决办法有很多什么配置config啦,gi ...

随机推荐

  1. 利用bat批量执行脚本文件

    1.读取目录文件 利用bat 的for命令读取中的sql文件 for /r %%c in (0*.sql) do echo %%c %%c 相当于变量 in() 中的为循环的范围 此句的作用是显示当前 ...

  2. Content Providers

    Content providers manage access to a structured set of data. They encapsulate the data, and provide ...

  3. Mysql在php5中的应用

    1.PHP与mysql建立连接 php.ini加载mysql组件 extension=php_mysql.dll 前的;去掉 extension_dir=””路径是否正确 PHP连接mysql函数 m ...

  4. URPF 简单流程

    主要功能是防止基于源地址欺骗的网络攻击. 路由器接口一旦使能URPF功能,当该接口收到数据报文时,首先会对数据报文的源地址进行合法性检查,对于源地址合法性检查通过的报文,才会进一步查找去往目的地址的转 ...

  5. html中发送邮箱的链接

  6. underscorejs-size学习

    2.24 size 2.24.1 语法: _.size(list) 2.24.2 说明: 返回列表的长度. 示例一:返回数组.对象.字符串的长度 //取数组的长度 var length length ...

  7. 【转载】详细解读C#中的 .NET 弱事件模式

    你可能知道,事件处理是内存泄漏的一个常见来源,它由不再使用的对象存留产生,你也许认为它们应该已经被回收了,但不是,并有充分的理由. 在这个短文中(期望如此),我会在 .Net 框架的上下文事件处理中展 ...

  8. 微信开放平台获取component_verify_ticket

    官方文档说明: 在公众号第三方平台创建审核通过后,微信服务器会向其“授权事件接收URL”每隔10分钟定时推送component_verify_ticket.第三方平台方在收到ticket推送后也需进行 ...

  9. codebook法分割前景目标

    利用codebook法训练得到背景模型后,对背景差分得到的掩模图像去噪声并找到较大连通域.相对于平均背景法,它的分割效果更好些.当然,分割效果和背景模型训练的帧数有很大关系,适当调整一些参数会得到更好 ...

  10. CentOS下命令行和桌面模式的切换方法(转载)

    桌面模式和命令行模式的切换方法 用编辑器打开 /etc/inittab 文件(这里用的是vi,你可以选择你喜欢的): #vi /etc/inittab 打开效果图如下: 桌面模式    : 把光标所在 ...