欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

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

程序员文章站 2024-03-14 09:08:52
...

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

一、问题情景

git pull 时报错 

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

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

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

三、我的解决方法 

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

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

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

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

git remote add 连接名称 URL

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

这时会存在这样的问题 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>

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

⑤进行push

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