码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2019-08-20 22:39:58      阅读:287      评论:0      收藏:0      [点我收藏+]

标签:public   identity   src   ima   新建   rsa   use   png   VID   

出现github 连接错误:

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

技术图片

刚开始以为是网络问题,github不能连接上,但是使用ssh命令,用端口443测试发现可以连接上github

ssh -T -p 443 git@ssh.github.com

Enter passphrase for key ‘/root/.ssh/id_rsa‘:

Hi yinfei1! You‘ve successfully authenticated, but GitHub does not provide shell access.

技术图片

于是就怀疑端口22不能使用,端口22为ssh默认端口,初步怀疑和github服务器有关,于是将其端口修改为443:

 

修改方法

切换到 cd ~/.ssh/

进入到~目录下面的.ssh下面,修改ssh配置,新建config文件

将上述文件添加配置:

Host github.com /*服务器地址为github地址*/

User "XXX@XX.com" /*github上的注册邮箱为用户账号*/

Hostname ssh.github.com /*服务器地址为github地址*/

PreferredAuthentications publickey /*采用公匙*/

IdentityFile ~/.ssh/id_rsa /*公匙文件路径*/

Port 443 /*修改端口为443*/

 

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

标签:public   identity   src   ima   新建   rsa   use   png   VID   

原文地址:https://www.cnblogs.com/yinfei/p/11385722.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!