栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

github.com port 22: Connection timed out

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

github.com port 22: Connection timed out

目录
    • 背景
    • 解决方案
    • 参考

背景
  • 今天突然用ssh方式 pull GitHub的项目报github.com port 22: Connection timed out
 $ git clone git@github.com:1030907690/dayAndNightAndroidCustomServerPy.git
Cloning into 'dayAndNightAndroidCustomServerPy'...
ssh: connect to host github.com port 22: Connection timed out
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

  • 这个大概是公司网络把访问出去22端口给屏蔽了,我telnet也不通。
解决方案
  • GitHub允许使用443端口,下面改成走443端口。
  • 先检查走443端口能否行得通。
ssh -T -p 443 git@ssh.github.com
  • 确认有successful提示,如下。
 The authenticity of host '[ssh.github.com]:443 ([20.205.243.160]:443)' can't be established.
ED25519 key fingerprint is SHA256:+DiY3wvvV6TuJJhbpZisF/zLDA0zPMSvHdkr4UvCOqU.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '[ssh.github.com]:443' (ED25519) to the list of known hosts.
Hi 1030907690! You've successfully authenticated, but GitHub does not provide shell access.

  • 确认可以,下一步编辑文件
vim ~/.ssh/config
  • 加入以下代码
Host github.com
Hostname ssh.github.com
Port 443
  • 测试是否成功ssh -T git@github.com,如下所示

  • 然后拉取项目就可以了,如下所示

参考
  • https://segmentfault.com/a/1190000040896781
  • https://www.jianshu.com/p/c3aac5024877
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/842547.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号