简体   繁体   中英

fatal: unable to access 'https://xxxx.git/': server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none

I am using a jupyter notebook in the cloud and I want to push my jupyter notebooks into gitlab.

I ran the following commands in the folder:

git init
git remote add origin https://xxx.git
git add .
git commit -m "first commit"
git push -u origin master

After the last command, I got the error:

error: src refspec master does not match any.

So I ran

git show-ref

This showed three refs

refs/heads/main

refs/remotes/origin/HEAD

refs/remotes/origin/main

Trying

git push origin HEAD:master

gave the error about failed certificate verification. What am I doing wrong?

Probably you don't have a correct SSL certificate in the server where you're hosting your GitHub instance.

Personally I would recommend you that you attach a correct certificate, since the ones from Let's Encrypt are totally free, but in any case you can disable SSL verification for a single command:

git -c http.sslVerify=false push origin -u

Or ( DON'T DO THAT AND USE A CORRECT CERTIFICATE ) disable it at all for all the repositories:

git config --global http.sslVerify false

Why disable ou bypass security?

I found the problem. In my Nginx configuration, I had to provide "fullchain" certificate. Example:

ssl_certificate /etc/letsencrypt/live/yourdomain.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/yourdomain.com/privkey.pem; # managed by Certbot

Or for Apache configuration, check an older post here: PKIX path building failed: unable to find valid certification path to requested target

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM