$ ssh -T git@github.comssh报错: connect to host github.com port 22: Connection refused
·
该报错表明你的 SSH 客户端无法连接到 GitHub 的 SSH 服务器。
GitHub 提供了通过 HTTPS 访问仓库的方式,可以作为临时解决方案来验证是否是 SSH 端口的问题。你可以克隆仓库时使用 HTTPS URL 而不是 SSH URL,如果git clone https://xxxx没问题,那说明就是ssh连接有问题。
GitHub 支持通过备用端口进行 SSH 连接(如 443 端口),我们可以尝试修改 SSH 配置文件来使用这个端口。如果在.ssh下没有config文件,那么要先创建一个
nano ~/.ssh/config
然后使用记事本打开config文件,输入以下内容:
Host github.com
HostName ssh.github.com
User git
Port 443
IdentityFile ~/.ssh/id_ed25519
保存并关闭
再次使用ssh -T命令测试ssh连接即可。
更多推荐
所有评论(0)