簡體   English   中英

Android repo init:SSL_CERTIFICATE_VERIFY_FAILED 錯誤

[英]Android repo init : SSL_CERTIFICATE_VERIFY_FAILED error

下載安卓源代碼:

我發出

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/manifesthttps://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 用戶(莫哈韋沙漠)。 我有同樣的錯誤。

當我啟動時:

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

好的,我通過將環境變量 PYTHONHTTPSVERIFY 設置為 0 來解決此問題

導出 PYTHONHTTPSVERIFY=0

Python, since v2.7.9, will by default now check the SSL certificates. To revert to the correct behavior for the repo script, set up an environment variable PYTHONHTTPSVERIFY=0.
This will shut off all certificate verification.

回購腳本現在應該像宣傳的那樣運行。

我在這個主題上花了 3 個小時,終於發現這些命令對我有用。

我的 python3 是 Python 3.6.9,python 是在 Ubuntu 18.04 上運行的 Python 2.7.17。

sudo apt-get install git-core gnupg flex bison build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z1-dev libgl1-mesa-dev libxml2-utils xsltproc unzip fontconfig
sudo apt-get install openjdk-8-jdk android-tools-adb bc bison build-essential curl flex g++-multilib gcc-multilib gnupg gperf imagemagick lib32ncurses5-dev lib32readline-dev lib32z1-dev liblz4-tool libncurses5-dev libsdl1.2-dev libssl-dev libwxgtk3.0-gtk3-dev libxml2 libxml2-utils lzop pngcrush rsync schedtool squashfs-tools xsltproc yasm zip zlib1g-dev git-core python3.8 libncurses5
sudo apt-get install ca-certificates
sudo update-ca-certificates --fresh
sudo update-alternatives --install /bin/python python /usr/bin/python3 1
sudo update-alternatives --install /bin/python python /usr/bin/python3.8 2
sudo update-alternatives --config python //choose 2
mkdir ~/bin
PATH=~/bin:$PATH
curl -k https://storage.googleapis.com/git-repo-downloads/repo-1 > ~/bin/repo
chmod a+x repo 
git config http.sslVerify false
export PYTHONHTTPSVERIFY=0
git config --global user.name "xxx"
git config --global user.name "xxx@xxx.com"
mkdir ./workspace
cd workspace
which repo
repo init -u https://android.googlesource.com/platform/manifest -b master
repo sync -j2

希望我的分享能幫到你:)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM