【解决方法】git pull报错ssh: connect to host github.com port 22: Connection timed out

问题

复制代码
git pull
ssh: connect to host github.com port 22: Connection timed out
fatal: Could not read from remote repository.

解决方法

在C:\Users\username.ssh文件夹下新建config文件,填入以下文本(如有则直接在文件最后一行新增):

复制代码
Host github.com
  Hostname ssh.github.com
  Port 443

将22端口修改为443即可。

验证:

复制代码
ssh -T git@github.com

出现Hi xxxx! You've successfully authenticated, but GitHub does not provide shell access.即正常。

参考资料

https://zhuanlan.zhihu.com/p/521340971

相关推荐
Irene19915 小时前
查看是否已安装 Git 的方法
git
my_power5206 小时前
检出git项目到android studio该如何配置
android·git·android studio
安果移不动6 小时前
Git 实战:如何优雅地撤销历史中的某一个 Commit?
git
周杰伦_Jay6 小时前
【大模型数据标注】核心技术与优秀开源框架
人工智能·机器学习·eureka·开源·github
吴敬悦9 小时前
私有的 GitHub Package 怎么拉取?
npm·github
啥都不懂的小小白9 小时前
Git 入门指南:从零开始掌握版本控制
git
AI逐月9 小时前
Git 彻底清除历史记录
大数据·git·elasticsearch
有什么东东10 小时前
Windows安装git教程以及初步使用
git
不爱吃米饭_10 小时前
Gitea 轻量级的Git方案 - Gitlab的替代品
git·gitlab·gitea
小胖霞12 小时前
全栈系列(15)github Actions自动化部署前端vue
前端·node.js·github