git 无法验证 https://rubygems.org/ 的 SSL 证书
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20126316/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Could not verify the SSL certificate for https://rubygems.org/
提问by cdpalmer
I'm getting this error when I run bundle install
:
运行时出现此错误bundle install
:
Could not verify the SSL certificate for https://rubygems.org/.
There is a chance you are experiencing a man-in-the-middle attack, but most likely
your system doesn't have the CA certificates needed for verification. For
information about OpenSSL certificates, see bit.ly/ruby-ssl. To connect without using
SSL, edit your Gemfile sources and change 'https' to 'http'.
However, it is only happening to one of my projects, and seems to be happening to only me. Also, I can get around it by running bundle update
, where I don't get that error, and I can get up a running after that.
然而,它只发生在我的一个项目上,而且似乎只发生在我身上。另外,我可以通过运行来解决它bundle update
,在那里我没有收到那个错误,然后我可以开始跑步。
Is there something that isn't tracked in the project (that is only on my machine) that I have misconfigured?
有没有在我配置错误的项目中(仅在我的机器上)未跟踪的内容?
回答by Michael Klishevich
I had this problem on Mac OS X Yosemite with ruby 2.3.1.
I fixed the problem by downloading http://curl.haxx.se/ca/cacert.pemto
/usr/local/etc/openssl/
我在带有 ruby 2.3.1 的 Mac OS X Yosemite 上遇到了这个问题。我通过下载解决了这一问题http://curl.haxx.se/ca/cacert.pem到
/usr/local/etc/openssl/
and adding this line export SSL_CERT_FILE=/usr/local/etc/openssl/cacert.pem
to .bash_profile
并将这一行添加export SSL_CERT_FILE=/usr/local/etc/openssl/cacert.pem
到.bash_profile
Credit to Can't run Ruby 2.2.3 with RVM on OSXbut it was hard to google the right answer, so added to this page.
归功于Can't run Ruby 2.2.3 with RVM on OSX但很难在谷歌上找到正确的答案,所以添加到这个页面。
回答by Micah Alcorn
The solution for me on OS X 10.9.5 was to sudo rvm osx-ssl-certs update all
.
我在 OS X 10.9.5 上的解决方案是sudo rvm osx-ssl-certs update all
.
Source: http://jacopretorius.net/2013/10/could-not-verify-the-ssl-certificate-for-rubygems.html
来源:http: //jacopretorius.net/2013/10/could-not-verify-the-ssl-certificate-for-rubygems.html
回答by user3408293
Running gem update --system
worked for me
跑步gem update --system
对我有用
回答by Jordan Morris
For linux users, simply install the package: ca-certificates
对于 linux 用户,只需安装软件包: ca-certificates
回答by cdpalmer
Since I am using rbenv
instead of rvm
, I wasn't able to do most of the solutions online.
由于我使用的是rbenv
而不是rvm
,因此我无法在线完成大部分解决方案。
I was able to fix the issue by uninstalling and reinstalling openssl
我能够通过卸载并重新安装来解决该问题 openssl
All is well, but I am not exactly sure why.
一切都很好,但我不确定为什么。
回答by Pranava S Balugari
Upgrading openssl should fix the issue.(if it's MacOSX)
升级 openssl 应该可以解决这个问题。(如果是 MacOSX)
brew upgrade openssl
回答by JonyFang
Maybe this method will be useful
也许这个方法会有用
1.Switch source to https://gems.ruby-china.org/
1.切换源 https://gems.ruby-china.org/
$ gem sources --add https://gems.ruby-china.org/ --remove https://rubygems.org/
2.Check current source
2.检查电流源
$ gem sources -l
*** CURRENT SOURCES ***
https://gems.ruby-china.org
3.Mirror gem source
3.镜像宝石来源
$ bundle config mirror.https://rubygems.org https://gems.ruby-china.org
Through these methods, you will not need to change Gemfile souce
.
通过这些方法,您将无需更改Gemfile souce
.
Hope this method will be useful for you.
希望这个方法对你有用。