【解决方法】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

相关推荐
寻月隐君7 分钟前
想用 Rust 开发游戏?这份超详细的入门教程请收好!
后端·rust·github
SoFlu软件机器人2 小时前
Cursor、飞算JavaAI、GitHub Copilot、Gemini CLI 等热门 AI 开发工具合集
人工智能·github·copilot
言之。3 小时前
借助ssh实现web服务的安全验证
运维·安全·ssh
落雪小轩韩3 小时前
Git 常用操作与注意事项全攻略
大数据·git
winds~3 小时前
【Git】git的回退功能
大数据·git·elasticsearch
Ring__Rain3 小时前
git fetch的使用
git
Albert_Lsk9 小时前
【2025/07/11】GitHub 今日热门项目
人工智能·开源·github·开源协议
心.c11 小时前
后台管理系统-权限管理
javascript·react.js·github
一点一木11 小时前
🚀 2025 年 06 月 GitHub 十大热门项目排行榜 🔥
前端·人工智能·github
寻月隐君12 小时前
Rust 错误处理终极指南:从 panic! 到 Result 的优雅之道
后端·rust·github