android - Android repo init:SSL_CERTIFICATE_VERIFY_FAILED 错误
问题描述
下载 Android 源代码:
我正在发行
repo init -u https://android.googlesource.com/platform/manifest
但我收到以下错误:
fatal: Cannot get https://gerrit.googlesource.com/git-repo/clone.bundle
fatal: error [SSL_CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c :726)
fatal: cloning the git-repo repository,will remove '.repo/repo'
我试过什么?
-我已经尝试从谷歌浏览器和 Internet Explorer 访问 https://android.googlesource.com/platform/manifest和 https://gerrit.googlesource.com/git-repo/clone.bundle并且没有问题
-尝试在 repo init 命令中将 https 更改为 http
-修改了repo脚本并将https更改为http
- 修改 gitconfig 如下:
[user]
name = myName
email = myemail.id
[http]
proxy = http://user:passwd@gateway.com:8080
sslVerify = false
[https]
proxy = https://user:passwd@gateway.com:8080
sslVerify = false
如何导入这些站点的证书?我正在使用 Ubuntu 18.04 。有没有办法强制忽略这个?
PS:我在代理后面并且已经设置了代理设置并且工作正常。(尝试了 sudo apt-get update)
解决方案
我是 MAC 用户 (Mojave)。我有同样的错误。
当我启动时:
repo init <repository url>
我收到此错误:
Downloading Repo source from https://gerrit.googlesource.com/git-repo
fatal: Cannot get https://gerrit.googlesource.com/git-repo/clone.bundle
fatal: error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:852)
fatal: cloning the git-repo repository failed, will remove '.repo/repo'
问题似乎是由于 MacOS 上的 Python 3.6 带有自己的 OpenSSL 私有副本。这意味着 Python ssl 模块不再将系统中的信任证书用作默认值。要解决这个问题,您需要在系统中安装一个 certifi 包。
解决了:
open /Applications/Python\ 3.6/Install\ Certificates.command