2

I am a new git/github user and have encountered the following

error fatal: unable to access 'https://github.com/myusername/my-repo.git/': SSL certificate problem: self-signed certificate in certificate chain

This has me confused because I have made pushes to my remote GitHub repository before without issue. I confirmed that the origin is correct and got the same error message upon running git push and git push -u origin master. I have seen similar questions which don't quite seem to match my situation as either deal with a situation in which the repo is attempting to be cloned (while I am trying to upload) or have not used 'https' (or some other issue).

There is a post which suggests an answer (How to Fix SSL certificate error when want to push to GitHub using git bash?) but I am really very confused as I have never had to explicitly deal with keys before. And no tutorial I have viewed have mentioned them.

Any thoughts? I am on a Windows 10 system using git bash. I am on the same home network I have used to make successful pushes in the past.

Vy Do
  • 46,709
  • 59
  • 215
  • 313
Shadow43375
  • 514
  • 7
  • 20

3 Answers3

3

similar issues happen to me when cloning a repo you can try this

git config --global http.sslVerify false

https://confluence.atlassian.com/fishkb/unable-to-clone-git-repository-due-to-self-signed-certificate-376838977.html

Update: Well if you aren't familiar with openssl then you need to get and use it.

unset ignorance

git config --global --unset http.sslVerify

If you do have it and already created a Certificate then try verifying it just to see what it says

openssl verify domain.crt

Renew it if it has expired

openssl x509 -in domain.crt -noout -enddate

If you don't have one, generate your server credentials first

openssl req \
   -newkey rsa:2048 -nodes -keyout domain.key \
   -out domain.csr

Now create it

openssl x509 \
   -signkey domain.key \
   -in domain.csr \
   -req -days 365 -out domain.crt

put it into pem file

cert.pem

Now import it

git config http.sslCert ~/path/to/ssl/cert.pem

Then check it with

git config --global --list

Sources with a few more minor details

user3685048
  • 119
  • 9
0

Set git to trust your certificate using http.sslCAInfo parameter

Configure your certificate as:

git config --global http.sslCAInfo <path to your .pem file>

You can check your config by:

git config --list
-1

just do some step

git config --global user.email "your email address" git config --global user.name "username"

and firstly make sure that your pc ssh key is added to your git account in setting->ssh key section

Ashish
  • 77
  • 11