Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android repo init : SSL_CERTIFICATE_VERIFY_FAILED error

For downloading the Android Source code :

I am issuing

repo init -u https://android.googlesource.com/platform/manifest

But I am getting the below error :

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'

What I have tried ?

-I have tried visiting https://android.googlesource.com/platform/manifest and https://gerrit.googlesource.com/git-repo/clone.bundle from the google chrome and internet explorer and there is no issue

-Tried changing the https to http in the repo init command

-modified the repo script and changed https to http

-modified the gitconfig as below :

[user]
        name = myName
        email = myemail.id
[http]
        proxy = http://user:[email protected]:8080
        sslVerify = false
[https]
        proxy = https://user:[email protected]:8080
        sslVerify = false

How can I import the certificates for these sites ? I am using Ubuntu 18.04 . Is there a way to force ignore this?

PS : I am behind the proxy and have already setup the proxy settings and it is working fine.(tried sudo apt-get update)

like image 823
Raulp Avatar asked Oct 15 '25 07:10

Raulp


2 Answers

i am a MAC user (Mojave). I have the same error.

When i launch:

repo init <repository url>

I get this error:

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'

The problem seems due to Python 3.6 on MacOS that comes with its own private copy of OpenSSL. That means the trust certificates in the system are no longer used as defaults by the Python ssl module. To fix that, you need to install a certifi package in your system.

Solved with:

open /Applications/Python\ 3.6/Install\ Certificates.command
like image 143
Luca Scandroglio Avatar answered Oct 17 '25 20:10

Luca Scandroglio


OK , I fixed this by setting the environment variable PYTHONHTTPSVERIFY to 0

export 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.

The repo script should now run as advertised.

like image 21
Raulp Avatar answered Oct 17 '25 21:10

Raulp



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!