问题情况

本来一直用的是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. 使用Convert 类和Parse方法将字符串转换为数值类型

    //用Parse方法将字符串转换为数值类型; long num=Int64.Parse(args[2]) //用别名为Int64c#类型long; long num=long.Parse(args[2 ...

  2. E/Trace: error opening trace file: No such file or directory

    E/Trace: error opening trace file: No such file or directory (2) 有这一个错误,想了一下,然后发现是 AdroidManifest.xm ...

  3. copy file using FileReader/Writer.

    The code below demonstates copying file using 'FileReader' and 'FileWriter'. class CopyV2 extends Ti ...

  4. 部分A+B_1

    正整数A的“DA(为1位整数)部分”定义为由A中所有DA组成的新整数PA.例如:给定A = 3862767,DA = 6,则A的“6部分”PA是66,因为A中有2个6. 现给定A.DA.B.DB,请编 ...

  5. animationWithKeyPath键值对

    animationWithKeyPath键值对的方式来改变动画 <Jacky Shin:可以从这个网址查到哪些可以做为动画效果, 打开xcode帮助,搜索animatable propertie ...

  6. 【原】iOS 获取当前和 前后n天的日期

    原文:http://www.cnblogs.com/A--G/p/4759810.html 一.获取当前日期需要调用一个简单的方法:[NSDate date];//获取现在的日期 -(NSString ...

  7. Java-生成验证码图片(自定义内容,尺寸,路径)

    1 package cn.gp.tools; import java.awt.*; import java.awt.image.BufferedImage; import java.io.*; imp ...

  8. javascript--15条规则解析JavaScript对象布局(__proto__、prototype、constructor)

    大家都说JavaScript的属性多,记不过来,各种结构复杂不易了解.确实JS是一门入门快提高难的语言,但是也有其他办法可以辅助记忆.下面就来讨论一下JS的一大难点-对象布局,究竟设计JS这门语言的人 ...

  9. iOS 对视频抽帧。

    这里有两种方法可以采用, 方法一:使用MPMoviePlayerController MPMoviePlayerController *moviePlayer = [[MPMoviePlayerCon ...

  10. Python自动化运维之30、Flask框架

    Flask 官网:http://flask.pocoo.org/ flask是一个基于Python开发并且依赖jinja2模板和Werkzeug WSGI服务的一个微型框架,对于Werkzeug本质是 ...