Trying to load files from github through a firewall is impossibly slow. Any suggestions for workarounds?

雨燕双飞 提交于 2019-12-02 18:10:06

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.

Or... just change the "git://" prefix to "http://"

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.

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 automatically if you modify your (global) git config:

$ git config --global url.git://localhost/.insteadOf git://github.com/

The git:// protocol uses port 9418, so you should make sure your firewall allows outbound connections to this port.

I'm use git clone git@ssh.github.com:xxx.user/xxx.proj

git config --global url."https://".insteadOf git://

Done!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!