输入git push命令显示ssh: connect to host github.com port 22: Connection timed out fatal: Could not read from
之前都好好的,今天 git push 的时候突然出现这个问题:
解决方法:更改SSH端口(亲测可用)
先试试这个命令:
ssh -T -p 443 git@ssh.github.com
此时出现如下提示信息:
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 host key is known by the following other names/addresses: ~/.ssh/known_hosts:1: github.com Are you sure you want to continue connecting (yes/no/[fingerprint])?
输入 yes ,然后如果出现下面这个提示 Hi 你的github用户名 ,则443端口连接成功:
Warning: Permanently added '[ssh.github.com]:443' (ED25519) to the list of known hosts. Hi youname! You've successfully authenticated, but GitHub does not provide shell access.
进入 ~/.ssh 下:
cd ~/.ssh
创建一个config文件(这里我用的vim编辑器):
vim config
编辑文件内容:
Host github.com HostName ssh.github.com Port 443
然后 git push 或者 git pull 应该就成功了
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通