当我尝试通过 git URL 进行克隆时,为什么会出现“无法连接套接字”?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5015732/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Why do I get "unable to connect a socket" when I try to clone via a git URL?
提问by Nyambaa
When I try to clone a project from the GitHub, it gives me the following error.
当我尝试从 GitHub 克隆项目时,出现以下错误。
:git clone git://github.com/project.git
github.com[0: 207.97.227.239]: errno=Connection refused
fatal: unable to connect a socket (Connection refused)
But if I use the corresponding HTTP URL, it's fine:
但是如果我使用相应的HTTP URL,那就没问题了:
:git clone http://github.com/project.git
What should I to do to clone through a git URL?
我应该怎么做才能通过 git URL 进行克隆?
回答by Fabian
Uku Loskit is right about the port being blocked. The solution is to set up your remote's URL without using git://
Uku Loskit 关于端口被阻塞的说法是正确的。解决方案是在不使用的情况下设置遥控器的 URLgit://
I use: https://github.com/user/project.git
or [email protected]:user/project.git
我使用:https://github.com/user/project.git
或[email protected]:user/project.git
回答by Uku Loskit
Looks like there is a network problem because the git protocol, by default, uses the port 9418. Looks like your traffic is blocked on that port.
看起来存在网络问题,因为 git 协议默认使用端口 9418。看起来您的流量在该端口上被阻止。
回答by ALi Nezamifar
I have the same problem. This is because port 9418 is blocked. If you have directadmin, open port 9418 in csf firewall and restart it.
我也有同样的问题。这是因为端口 9418 被阻止了。如果你有 directadmin,请在 csf 防火墙中打开端口 9418 并重新启动它。