目 录CONTENT

文章目录

git: connect to host github.com port 22: Connection timed out

过客
2024-02-02 / 0 评论 / 0 点赞 / 5 阅读 / 0 字

好几年没用github了,今天提交代码发现直接报错了connect to host github.com port 22: Connection timed out
后面看了一下github说明,他们https模式的提交,启用了ssh协议,但ssh协议使用的是443端口而不是默认的22端口。

1. 测试

先用ssh协议测试ssh.github.com443端口是否正常

> ssh -T -p 443 git@ssh.github.com
Hi zngw! You've successfully authenticated, but GitHub does not provide shell access.

2. 配置ssh,让github.com使用443端口

打开用户名下的ssh配置文件~/.ssh/config,如果没有,直接创建一个

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

3. 再次提交

git pull
0
git
  1. 支付宝打赏

    qrcode alipay
  2. 微信打赏

    qrcode weixin

评论区