有代理能访问到github,也在github上配置了ssh的密钥。但是使用git ssh访问不了。
git clone git@github.com:xxx.git
修改文件 ~/.ssh/config (window: C:\Users\Lenovo.ssh\config )
我添加了以下内容
Host github.com
User <Your email>
Hostname ssh.github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa
Port 443
然后,执行命令ssh -T git@github.com
确认问题是否解决,最后在执行之前的命令就能成功运行了。
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:2: github.com
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
注:过程中需要根据提示输入 yes
根据这个
有时,防火墙完全拒绝允许SSH连接。如果不能使用带凭据缓存的HTTPS克隆,则可以尝试使用通过HTTPS端口建立的SSH连接进行克隆。大多数防火墙规则应该允许这样做,但代理服务器可能会干涉
参考链接:https://stackoverflow.com/questions/15589682/ssh-connect-to-host-github-com-port-22-connection-timed-out