ssh:connect to host github.com port 22

相关链接

知乎链接

相关问题部分截图如下:

相关问题截图

问题描述

本地仓库在推送到github远端仓库时出现报错如下

1
2
3
4
5
6
> git pull --tags origin main
ssh: connect to host github.com port 22: Connection timed out
fatal: Could not read from remote repository.

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

解决方案

新建~/.ssh/config文件, 写入如下内容

1
2
3
Host github.com
Hostname ssh.github.com
Port 443

保存后问题解决