git 试图通过防火墙从 github 加载文件是不可能的慢。有关解决方法的任何建议?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/88476/
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
Trying to load files from github through a firewall is impossibly slow. Any suggestions for workarounds?
提问by charliepark
I'm a little hesitant to post this, as I'm not completely sure what I'm doing. Any help would be wonderful.
我有点犹豫要不要发布这个,因为我不完全确定我在做什么。任何帮助都会很棒。
I'm on a computer with a firewall/filter on it. I can download files without any difficulty. When I try to clone files from Github, though, the computer just hangs. Nothing happens. It creates a git file in the folder, but the key files don't get loaded in. For context, I'm working on a Rails app, trying to load in Restful Authentication.
我在一台装有防火墙/过滤器的计算机上。我可以毫无困难地下载文件。但是,当我尝试从 Github 克隆文件时,计算机就挂了。没发生什么事。它会在文件夹中创建一个 git 文件,但不会加载密钥文件。对于上下文,我正在开发一个 Rails 应用程序,尝试加载 Restful Authentication。
Have any of you dealt with this? Any suggestions for getting the clone to work? Disabling the firewall might be an option, but if I can do something without going through that process, I'd appreciate it.
你们有人处理过这个吗?有什么建议可以让克隆工作吗?禁用防火墙可能是一种选择,但如果我可以在不经过该过程的情况下做某事,我将不胜感激。
回答by zvikara
Github supports cloning using both the git protocol over port 9418 and HTTP over port 80. Using the later is very slow (Reference). You should open port 9418 on your firewall or use HTTP cloning otherwise.
Github 支持在端口 9418 上使用 git 协议和在端口 80 上使用 HTTP 进行克隆。使用后者非常慢(参考资料)。您应该在防火墙上打开端口 9418 或否则使用 HTTP 克隆。
回答by Eric Kramer
Or... just change the "git://" prefix to "http://"
或者......只需将“git://”前缀更改为“http://”
回答by rogerdpack
If you're firewalled out of existence and want the speed of git [update: HTTP(S) is practically as fast as ssh these days, but this information is still useful if SSH is the only way to access a repo], and have ssh access to a machine that isn't firewalled, then use an ssh tunnel.
如果您的防火墙不复存在并且想要 git 的速度 [update: HTTP(S) 现在几乎和 ssh 一样快,但是如果 SSH 是访问 repo 的唯一方法],并且有ssh 访问没有防火墙的机器,然后使用 ssh 隧道。
To do so, run this in one window, and leave it running:
为此,请在一个窗口中运行它,并让它继续运行:
$ ssh username@some_host_not_firewalled -L9418:github.com:9418
Then wherever you used the former command:
然后无论您在哪里使用前一个命令:
$ git clone git://github.com/jruby/jruby.git
use this instead:
改用这个:
$ git clone git://localhost/jruby/jruby.git
This translation can be done automaticallyif you modify your (global) git config:
如果您修改(全局)git 配置,则可以自动完成此转换:
$ git config --global url.git://localhost/.insteadOf git://github.com/
回答by Greg Hewgill
The git://
protocol uses port 9418, so you should make sure your firewall allows outbound connections to this port.
该git://
协议使用端口 9418,因此您应该确保您的防火墙允许到该端口的出站连接。
回答by ken
I'm use git clone [email protected]:xxx.user/xxx.proj
我正在使用 git clone [email protected]:xxx.user/xxx.proj
回答by Buddhi Kasun
git config --global url."https://".insteadOf git://
Done!
完毕!