美文网首页前端
[解决]git-ssh: connect to host git

[解决]git-ssh: connect to host git

作者: 是苏菇凉呀 | 来源:发表于2020-02-02 00:24 被阅读0次

最近在更新了本地代码 node 版本后,提交代码时报错如下

$ git pull project develop
ssh: connect to host github.com port 22: Connection timed out
fatal: Could not read from remote repository.

本以为是网络的问题或者被墙了,在确认本地 git 可以访问和几次尝试后依旧报这个错,查了各种资料,最后参考 git 官网给的解决办法(https://help.github.com/en/github/authenticating-to-github/using-ssh-over-the-https-port),使用 ssh 443端口

1. 先测试可用性

ssh -T -p 443 git@ssh.github.com
如果提示如下说明可用

one.jpg
2.然后编辑 ~/.ssh/config 文件,如果没有config文件的话就直接 vim ~/.ssh/config加入以下内容

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

3.再次测试

ssh -T git@github.com
提示如下就说明成功了

two.jpg

相关文章

网友评论

    本文标题:[解决]git-ssh: connect to host git

    本文链接:https://www.haomeiwen.com/subject/syxxxhtx.html