我在一个代理下,我正在推进Git成功了很长一段时间。
现在我无法突然将git推入。
我已经设置了RSA密钥和代理服务器,并对它们进行了双重检查,结果没有任何结果,git向我抛出页面标题中显示的错误。ssh:连接到主机github.com端口22:连接超时
回答
的原因可能是修改防火墙,你是下一个网络。(在这种情况下,他们可能会故意遮挡部分港口)
要仔细检查,如果是这个原因...做
ssh -T [email protected]
这应该超时。 如果是这样的话,使用http协议而不是ssh这种方式
只需将配置文件中的url更改为http即可。
方法如下: -
git config --local -e
的
url = [email protected]:username/repo.git
变化进入
url = https://github.com/username/repo.git
HTTPS repo URI的实际格式是'https:// github.com/username/repo.git'而不是'https:// pboone @ github.com/username/repo.git' – lantrix 2014-01-20 00:05:04
@lantrix true that! – 2014-01-20 09:07:46
我有这个问题一次,但重新启动我的电脑解决了它。 – 2016-01-09 17:20:00
基本URL重写
,Git提供了一种方法来重写使用Git配置的URL。只需发出以下命令:
git config --global url."https://".insteadOf git://
现在,仿佛被施了魔法,所有Git命令将执行的git://
置换为https://
来源: git:// protocol blocked by company, how can I get around that?
谢谢!我们在Jenkins构建过程中,所以我无法手动编辑git文件(我没有jenkins帐户的git凭证) - 所以这非常有用。 – Phil 2015-03-27 15:32:32
这太好了。我为每个添加了git别名,以便轻松切换 – lfender6445 2015-03-31 23:59:31
关于github,命令应该是:'git config --global url。“https://github.com/”.insteadOf [email protected]:'。注意不同之处:'@'变成'//',':'变成'/'。 – Frodon 2016-01-21 14:38:04
执行:
nc -v -z <git-repository> <port>
您的输出应该看起来像E:
"Connection to <git-repository> <port> port [tcp/*] succeeded!"
如果你得到:
connect to <git-repository> <port> (tcp) failed: Connection timed out
您需要编辑您的〜/ .ssh/config文件。添加像下面这样:
Host example.com
Port 1234
我有同样的问题,但我发现答案是不同的,以为有人可能会遇到这个问题,所以这里是我的解决方案。
我不得不白名单2层的IP端口22
,80
,443
,并9418
:
192.30.252.0/22
185.199.108.0/22
如果这些IP的不工作,这可能是因为他们得到更新,你可以找到最多的在this page上出租。
- 1. npm安装错误:ssh:连接到主机github.com端口22:连接超时
- 2. ssh:连接到主机bitbucket.org端口22:连接超时
- 3. ssh:连接到主机128.114.126.232端口22:连接超时
- 4. ssh:连接到主机X.X.X.X端口22:连接超时
- 5. 的ssh:连接到主机heroku.com端口22:连接超时
- 6. 的ssh:连接到主机X.X.X.X端口22:操作超时
- 7. 的ssh:连接到主机<site-name>端口22:连接超时
- 8. 的ssh:连接到主机bitbucket.org端口22:连接超时致命
- 9. ssh服务器连接到主机xxx端口22:连接超时在linux-ubuntu
- 10. 的ssh:连接到主机heroku.com端口22:连接被拒绝
- 11. ssh:连接到主机heroku.com端口22:没有路由主机
- 12. 安装hadoop时ssh失败:连接主机主机端口22:连接拒绝
- 13. SSH:debug1:连接到github.com [192.30.253.112]端口22
- 14. tsung postgresql ssh:连接到主机localhost端口22:连接被拒绝
- 15. 的ssh:连接到主机的Heroku端口22:连接被拒绝
- 16. rsync端口22:连接超时
- 17. ssh:连接到主机localhost端口2222:连接被拒绝
- 18. ssh:端口22拒绝连接
- 19. Aws ec2 ssh连接到主机连接超时
- 20. 如何配置hadoop使用非默认端口:“0.0.0.0:ssh:连接到主机0.0.0.0端口22:连接被拒绝”
- 21. 在Windows 10上Bash Ubuntu,连接到主机端口22:连接失败
- 22. 无法连接到github.com端口443:操作超时
- 23. git push heroku master给出错误ssh:连接到主机heroku.com端口22:连接拒绝
- 24. 当使用no-ip主机名连接到树莓派时,ssh连接超时
- 25. ssh连接超时
- 26. SSH连接超时
- 27. com.sun.mail.util.MailConnectException:无法连接到主机,端口:localhost,25;超时-1;
- 28. 问题连接到主机端口25
- 29. 连接到来自不同主机的SSH转发端口
- 30. 无法打开连接到主机,端口23:连接失败
在你的移动设备上创建一个热点,通过你的移动设备连接,然后'git push'。为我工作。 – zundi 2017-09-12 19:19:41