ssh: connect to host github.com port 22: Connection timed out的解决方法

在提交基于zookeeper实现的分布式锁时,遇到如下问题: 

一、问题情景

git pull 时报错 

 二、可能的原因:在GitHub端的公钥失效

三、我的解决方法 

①利用HTTPS进行传输,选择HTTPS的URL  

②利用HTTPS的URL建立本地仓库与远程仓库的连接

git remote add 连接名称 URL

这时会存在这样的问题 Failed to connect to github.com port 443: Timed out

③可以通过设置代理解决

git config --global http.proxy

git config --global --unset http.proxy

④这时就可以pull成功了

git pull <remote> <branch>

⑤进行push

猜你喜欢

转载自blog.csdn.net/weixin_42228338/article/details/90315177