最近在使用brew
升级git
的时候,报告如下错误:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
$ brew install git -s -d -v --env=std Warning: You are using macOS 10.11. We (and Apple) do not provide support for this old version. You will encounter build failures with some formulae. Please create pull requests instead of asking for help on Homebrew's GitHub, Discourse, Twitter or IRC. You are responsible for resolving any issues you experience while you are running this old version. Updating Homebrew... ==> Downloading https://www.kernel.org/pub/software/scm/git/git-htmldocs-2.27.0. curl: (60) SSL certificate problem: Invalid certificate chain More details here: http://curl.haxx.se/docs/sslcerts.html curl performs SSL certificate verification by default, using a "bundle" of Certificate Authority (CA) public keys (CA certs). If the default bundle file isn't adequate, you can specify an alternate file using the --cacert option. If this HTTPS server uses a certificate signed by a CA represented in the bundle, the certificate verification probably failed due to a problem with the certificate (it might be expired, or the name might not match the domain name in the URL). If you'd like to turn off curl's verification of the certificate, use the -k (or --insecure) option. Error: Failed to download resource "git--html" Download failed: https://www.kernel.org/pub/software/scm/git/git-htmldocs-2.27.0.tar.xz ==> Auto-updated Homebrew! Updated 1 tap (homebrew/cask). ==> Updated Casks balenaetcher gzdoom poi strawberry cabal hstracker stella trilium-notes Warning: You are using macOS 10.11. We (and Apple) do not provide support for this old version. You will encounter build failures with some formulae. Please create pull requests instead of asking for help on Homebrew's GitHub, Discourse, Twitter or IRC. You are responsible for resolving any issues you experience while you are running this old version. /usr/local/Homebrew/Library/Homebrew/brew.rb (Formulary::FormulaLoader): loading /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/gettext.rb /usr/local/Homebrew/Library/Homebrew/brew.rb (Formulary::FormulaLoader): loading /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/pcre2.rb /usr/bin/curl --disable --globoff --show-error --user-agent Homebrew/2.3.0\ \(Macintosh\;\ Intel\ Mac\ OS\ X\ 10.11.6\)\ curl/7.43.0 --retry 3 --location --silent --head --request GET https://www.kernel.org/pub/software/scm/git/git-htmldocs-2.27.0.tar.xz ==> Downloading https://www.kernel.org/pub/software/scm/git/git-htmldocs-2.27.0.tar.xz /usr/bin/curl --disable --globoff --show-error --user-agent Homebrew/2.3.0\ \(Macintosh\;\ Intel\ Mac\ OS\ X\ 10.11.6\)\ curl/7.43.0 --retry 3 --location --range 0-1 --dump-header - --write-out \%\{http_code\} --output /dev/null https://www.kernel.org/pub/software/scm/git/git-htmldocs-2.27.0.tar.xz /usr/bin/curl --disable --globoff --show-error --user-agent Homebrew/2.3.0\ \(Macintosh\;\ Intel\ Mac\ OS\ X\ 10.11.6\)\ curl/7.43.0 --fail --retry 3 --location --remote-time --continue-at 0 --output /Users/xxxx/Library/Caches/Homebrew/downloads/af92f79273b58e47216b46d936335255b08e1eb74369b4714bac1c0e0650b50e--git-htmldocs-2.27.0.tar.xz.incomplete https://www.kernel.org/pub/software/scm/git/git-htmldocs-2.27.0.tar.xz curl: (60) SSL certificate problem: Invalid certificate chain More details here: http://curl.haxx.se/docs/sslcerts.html curl performs SSL certificate verification by default, using a "bundle" of Certificate Authority (CA) public keys (CA certs). If the default bundle file isn't adequate, you can specify an alternate file using the --cacert option. If this HTTPS server uses a certificate signed by a CA represented in the bundle, the certificate verification probably failed due to a problem with the certificate (it might be expired, or the name might not match the domain name in the URL). If you'd like to turn off curl's verification of the certificate, use the -k (or --insecure) option. Error: Failed to download resource "git--html" Download failed: https://www.kernel.org/pub/software/scm/git/git-htmldocs-2.27.0.tar.xz /usr/local/Homebrew/Library/Homebrew/download_strategy.rb:312:in `rescue in fetch' /usr/local/Homebrew/Library/Homebrew/download_strategy.rb:309:in `fetch' /usr/local/Homebrew/Library/Homebrew/resource.rb:131:in `fetch' /usr/local/Homebrew/Library/Homebrew/formula_installer.rb:988:in `each' /usr/local/Homebrew/Library/Homebrew/formula_installer.rb:988:in `fetch' /usr/local/Homebrew/Library/Homebrew/cmd/install.rb:329:in `install_formula' /usr/local/Homebrew/Library/Homebrew/cmd/install.rb:261:in `block in install' /usr/local/Homebrew/Library/Homebrew/cmd/install.rb:259:in `each' /usr/local/Homebrew/Library/Homebrew/cmd/install.rb:259:in `install' /usr/local/Homebrew/Library/Homebrew/brew.rb:110:in `<main>' |
手工去下载数据,看到更具体的错误信息,如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
$ curl https://www.kernel.org/pub/software/scm/git/git-htmldocs-2.27.0.tar.xz curl: (60) SSL certificate problem: Invalid certificate chain More details here: http://curl.haxx.se/docs/sslcerts.html curl performs SSL certificate verification by default, using a "bundle" of Certificate Authority (CA) public keys (CA certs). If the default bundle file isn't adequate, you can specify an alternate file using the --cacert option. If this HTTPS server uses a certificate signed by a CA represented in the bundle, the certificate verification probably failed due to a problem with the certificate (it might be expired, or the name might not match the domain name in the URL). If you'd like to turn off curl's verification of the certificate, use the -k (or --insecure) option |
解决方法为暂时要求curl
忽略证书错误问题,如下:
1 2 3 4 |
$ touch ~/.curlrc # 增加禁止校验的参数 $ echo --insecure >> ~/.curlrc |
注意,上述配置之后,可能会出现类似如下错误:
1 |
curl: (22) The requested URL returned error: 403 [[[!!! BREAKING CHANGE !!!]]] Support for clients that do not support Server Name Indication is temporarily disabled and will be permanently deprecated soon. See https://status.python.org/incidents/hzmjhqsdjqgb and ht |
参考链接
How to fix curl: (60) SSL certificate: Invalid certificate chain