문제

The corporate filter has mis-categorized and blocked http://production.cf.rubygems.org

When I do sudo gem install ruby-debug it gives me an error. There is a post on help.rubygems.org about this.

How do I see what mirror it is connecting to? What file is the mirror list stored in? Is it possible to edit it and set alternate mirror?

Edit: Running gem sources -a http://ruby.taobao.org -V gives me:

GET http://ruby.taobao.org/specs.4.8.gz
302 Moved
GET http://192.168.1.50:15871/cgi-bin/blockpage.cgi?ws-session=1563260628
200 OK
ERROR:  While executing gem ... (Zlib::GzipFile::Error)
    not in gzip format
도움이 되었습니까?

해결책

You may try

# list the sources
gem sources -l

# remove a source
gem sources -r https://rubygems.org/

# add an alternative source
gem sources -a https://gems.ruby-china.com/

The above shows my steps to replace the default gem source, because the connection to rubygems.org is unstable here

다른 팁

To get around the firewall you can remove http source and add https source.

Following worked for me:

gem sources -r http://rubygems.org/    
gem sources -a https://rubygems.org/

This is because a content filtering firewall would not be able to decipher encrypted traffic. However, this may not work if the firewall has blocked rubygems.org domain url.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top