Windows 下换 gems.ruby-china.org 提示 SSL 问题解决方法

开始获取的时候报错如下

D:\>gem sources -a http://gems.ruby-china.org/

ERROR:  SSL verification error at depth 1: unable to get local issuer certificat
e (20)
ERROR:  You must add /O=Digital Signature Trust Co./CN=DST Root CA X3 to your lo
cal trusted store
Error fetching http://gems.ruby-china.org/:
        SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: ce

rtificate verify failed (https://upyun.gems.ruby-china.org/specs.4.8.gz)


解决办法:

1.使用地址:http://curl.haxx.se/ca/cacert.pem下载cacert.pem文件,设置环境变量SSL_CERT_FILE,值为指向cacert.pem文件的位置,然后运行cmd命令,执行

set SSL_CERT_FILE=ruby路径\cacert.pem
然后运行语句:

D:\>gem sources -a http://gems.ruby-china.org/
http://gems.ruby-china.org/ added to sources

D:\>gem sources -l
*** CURRENT SOURCES ***

http://gems.ruby-china.org/


添加进来了


你可能感兴趣的:(Windows 下换 gems.ruby-china.org 提示 SSL 问题解决方法)