ssh git提示timed out

1
2
$ ssh git@github.com
ssh: connect to host github.com port 22: Connection timed out

起初以为是网络通信异常、端口不通等问题。包括删除了ssh的密钥,重新生成添加,都无法解决。
后来在C:\Users\13116\.ssh目录下新建一个config文件,内容如下

1
2
3
4
5
6
Host github.com
User xxx@qq.com
Hostname ssh.github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa
Port 443

然后重新测试,成功

1
2
3
4
5
6
7
8
$ ssh -T git@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:11: github.com
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '[ssh.github.com]:443' (ED25519) to the list of known hosts.
Hi qianj! You've successfully authenticated, but GitHub does not provide shell access.

课程中心

在线课程