git clone遇到的[ssh: connect to host github.com port 22]
起因
在学习递归的时候,对汉诺塔
小研究了一番,参考网上写了个demo
,后面就想同步到github
。
过程
这台电脑是新电脑,所以需要先本地生成ssh key
:ssh-keygen -t rsa -C "youremail@example.com"
可参考-远程仓库。
第一步:ssh-keygen -t rsa -C "youremail@example.com"
;
第二步:在用户目录下,找到.ssh
文件夹下的id_rsa.pub
,打开先复制全部内容;
第三步:登录github
,个人帐号setting
下的SSH and GPG keys
,然后点击右上角的New SSH key
。之后把第二步复制的都拷贝到key
输入框;
第四步:开始克隆:git clone git@github.com:***/***.git
。
正常会成功的,可惜报错了!

解决
因为公司是代理上网,初步猜测应该是这个问题。
那就google
或baidu
寻找解决方式。
根据报错提示,应该是ssh
连不通。
网上找到ssh -T git@github.com
,可参考-Testing your SSH connection。
测试过结果如下:

所以,接着搜索ssh: connect to host github.com port 22: Connection timed out
,发现貌似找到解决方式了。

可参考-ssh: connect to host github.com port 22: Connection timed out
这个说的就是把协议从ssh
方式换成https
。先别管本地git config --local -e
是否可行,要尽快解决问题。
所以,git clone
的时候,换个协议就好了!
git clone https://github.com/***/***.git

小结
xxx
思考
- 为什么
ssh
协议会存在问题,而https
则不会?什么是ssh
协议?https
协议呢?两者的区别? git bash
下的git clone xxx
是怎么发请求的?类似于curl
?还是??- xxx
git clone遇到的[ssh: connect to host github.com port 22]的更多相关文章
- GitHub上传不了的解决 ssh: connect to host github.com port 22: Bad file number git did not exit cleanly (exit code 128)
问题情况 本来一直用的是github的客户端,结果现在上传的时候出问题了,去网站上看,新项目已经创建,但是代码却怎么都上传不上去.于是只好用命令行的方式解决. Tortoisegit上是这样说的: g ...
- 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'... ...
- Github拉取远端的时候提示“ssh: connect to host github.com port 22: Connection timed out”错误
在使用Github的时候,如果使用到拉取远端分支的时候或者测试ssh -T git@github.com的时候可能会出现连接失败的问题,错误描述为“ssh: connect to host githu ...
- 关于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 ...
- ssh: connect to host github.com port 22: Connection refused
假设git例如,下面的问题时,远程推送: [fulinux@ubuntu learngit]$ git push -u origin master ssh: connect to host githu ...
- 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: ...
- 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不能连接上,但是 ...
- 关于github报错 ssh: connect to host github.com port 22: Connection timed out fatal: Could not read from remote repository.
今天上午写demo的时候,突然pull不下代码了,报了一下这样情况的错误: 看了一下代码,怀疑是网路错误,因为在这以前一切都正常的,然后将代码复制搜索了一番,解决办法有很多什么配置config啦,gi ...
- ssh: connect to host gihub.com port 22: Connection timed out
方案1(本人使用此方案,问题得已解决): 可能是ssh-server未安装或者未启动.我的ubuntu 12.04 默认只安装了openssh-client,并没有安装server. 运行 ps -e ...
随机推荐
- ionic+cordova 学习开发App(一)
一.项目所需环境 (一)jdk 1.jdk的安装,必须同时包含Java 和javac [一般安装包中都包含有,可以确定下] (二)node.js 和NPM 1.大多插件和辅助工具都运行在NPm平台上. ...
- Java subList的使用
1. 在看<阿里巴巴java编程手册的时候>有如下强制约束 顺便学了一下subList. java.util.List中有一个subList方法,用来返回一个list的一部分的视图. Li ...
- Spring的引用内部Bean属性和给级联属性
第一个是内部Bean的配置: 首先是要理解其中的原理,再去操作就很简单了,下面老表就给大家说一下自己的观点(有点简单,但是老表我第一次学习的时候看着视频上的代码确实有点懵逼 ...
- 【转】ext4+delalloc造成单次写延迟增加的分析
转自 http://blog.tao.ma/?p=58 这篇文章是淘宝内核组的刘峥同学在内部技术论坛上发表的一篇文章,但是由于刘峥同学目前没有blog,征得本人同意,贴在我的blog上,如果大家喜欢, ...
- 使用 C++ 多态时需要注意的问题
本文为大便一箩筐的原创内容,转载请注明出处,谢谢:http://www.cnblogs.com/dbylk/ 最近工作中遇到一些关于使用多态的细节问题,在此记录一下. 一.多态和模板匹配 模板是 C+ ...
- Python中的数据结构 --- 列表(list)
列表(list)是Python中最基本的.最常用的数据结构(相当于C语言中的数组,与C语言不同的是:列表可以存储任意数据类型的数据). 列表中的每一个元素分配一个索引号,且索引的下标是从0开始. ...
- Apache配置php redis扩展
1.根据phpinfo,下载redis 下载地址:注意php版本号 http://windows.php.net/downloads/pecl/snaps/redis/2.2.5/ http://wi ...
- Objective C - 4 - 下载图片并且加载到View
#import "LoadInternetImageViewController.h" @interface LoadInternetImageViewController () ...
- 跟踪Makefile输出调试信息
/********************************************************************* * 跟踪Makefile输出调试信息 * 说明: * 有时 ...
- sersync2 文件的实时同步备份
|——需求: 监控192.168.9.5[主] 下的 /data/vmeipai 目录 --> 同步到 192.168.12.8 [备] 下的 /data/vmeipai 目录 |——网络拓 ...