简体   繁体   中英

How to tell gem command not to use SSL

I am trying to run the gem command to install/update some gems, but due to some network restrictions in this area, I get this error:

ERROR:  While executing gem ... (OpenSSL::SSL::SSLError)
    SSL_connect returned=6 errno=0 state=SSLv3 read finished A

(I think) this is mainly because of tampering with the SSL certificates.
Is there anyway to tell gem not to use SSL , to avoid the error?

Use HTTP instead of HTTPS if you are unable to solve the certs issue:

$ gem install rails --source http://rubygems.org

To avoid repeating this every time, either edit your ~/.gemrc or edit the file through the command line, like this:

$ gem sources --add http://rubygems.org
$ gem sources --remove https://rubygems.org
$ gem sources --list

*** CURRENT SOURCES ***
http://rubygems.org

Also, en every Gemfile you will need to change the first line from:

source 'https://rubygems.org'

To:

source 'http://rubygems.org'

Of course it would be much better if you manage to solve the certs issue as @p11y suggested on his comment.

The accepted answer didn't work for me. The following, however, did.

Edit .gemrc file

  • On Windows c:\\Users\\yourusername\\.gemrc

Specifically %HOMEPATH% in the event your path is different.

add:

:ssl_verify_mode: 0

It displayed the SSL errors but the install was successful.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM