#ruby 添加gem源的ssl异常问题解决记录
异常SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
问题现象:
gem source --add 添加国内源时,报ssl certificate 的异常,使用http问题也一样:
C:\WINDOWS\system32>gem sources --add http://gems.ruby-china.org
Error fetching http://gems.ruby-china.org:
SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (https://upyun.gems.ruby-china.org/specs.4.8.gz)
C:\WINDOWS\system32>gem sources --add https://gems.ruby-china.org
Error fetching https://gems.ruby-china.org:
SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (https://gems.ruby-china.org/specs.4.8.gz)
环境说明
Microsoft Windows [版本 10.0.14393]
(c) 2018 Microsoft Corporation。保留所有权利。
C:\Users\Administrator>ruby -v
ruby 2.5.1p57 (2018-03-29 revision 63029) [x64-mingw32]
C:\Users\Administrator>gem -v
2.7.7
Ruby 安装 - Windows
https://rubyinstaller.org/downloads/
Ruby Gems 下载
https://rubygems.org/pages/download
增加新的pem证书,解决问题
下载新证书: http://curl.haxx.se/ca/cacert.pem
配置环境变量:SSL_CERT_FILE 值为刚下载证书的存放位置: C:\Ruby21-x64\lib\ruby\site_ruby\2.1.0\rubygems\ssl_certs\cacert.pem
打开新的cmd窗口
RubyGems 域名变化,官方网站有公告!!!http://gems.ruby-china.com/
问题解决--------------2018/9/29