github git push 失效问题

以前推代码到github.com都比较正常,最近几天无论如何都不成功,一直超时,在互联网上搜索了大半天,终于才找到一篇文章解决问题。原文参考:https://bengsfort.github.io/articles/fixing-git-push-pull-timeout/。github文档参考:https://docs.github.com/en/authentication/troubleshooting-ssh/using-ssh-over-the-https-port

设置之前:

$ git push -v
ssh: connect to host github.com port 22: Operation timed out
fatal: Could not read from remote repository.

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

一直超时。

ssh测试:

$ ssh -T git@github.com

也是如此。

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

测试通过

修改~/.ssh/config:

Host github.com
    Hostname ssh.github.com
    Port 443

终于成功!

2024-02-13编辑:

或者检查ssh-agent:

killall ssh-agent; eval `ssh-agent`
posted @   卓能文  阅读(95)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· AI 智能体引爆开源社区「GitHub 热点速览」
· C#/.NET/.NET Core技术前沿周刊 | 第 29 期(2025年3.1-3.9)
· 从HTTP原因短语缺失研究HTTP/2和HTTP/3的设计差异
点击右上角即可分享
微信分享提示