Ruby 执行 bundle install 报错提示 SSL 过期

20121205_star · August 28, 2025 · Last by 20121205_star replied at September 01, 2025 · 218 hits

各位道友,是否遇到过此问题,可否帮忙看看? 开发环境: Ubuntu 24.04 Ruby 3.0.4 OpenSSL 3.0.13 30 Jan 2024 (Library: OpenSSL 3.0.13 30 Jan 2024) 搞过:export SSL_CERT_FILE=/path/to/cacert.pem(无效)

执行:bundle install 提示: Fetching source index from https://gems.ruby-china.com/

Retrying fetcher due to error (2/4): Bundler::Fetcher::CertificateFailureError Could not verify the SSL certificate for https://gems.ruby-china.com/. 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 https://railsapps.github.io/openssl-certificate-verify-failed.html. To connect without using SSL, edit your Gemfile sources and change 'https' to 'http'.

Could not verify the SSL certificate for https://gems.ruby-china.com/. 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 https://railsapps.github.io/openssl-certificate-verify-failed.html. To connect without using SSL, edit your Gemfile sources and change 'https' to 'http'.

并没有提示过期啊,它大概是系统里不认 WoTrus 的证书

Reply to hellorails

咋解决呢?不太懂

试试

sudo apt install ca-certificates
Reply to huacnlee

还是报一样的错

去除验证,都还是不行

You need to Sign in before reply, if you don't have an account, please Sign up first.