Junaid S.
Junaid S.

Reputation: 2642

Error setting certificate verify locations - Github

I am having problem accessing github repository through Git Bash.

2 days ago I was able to push/pull the repositories. Then

1) I created an account on gitlab.com

2) I generated ssh key on my local pc following GitLab and SSH keys using git bash on windows

3) After this I did not create/pull/push any repository on gitlab.

Today I make few changes in a code (that is deployed on github), when I try to push that code I get following error

fatal: unable to access 'https://github.com/junaidbinsarfraz/repo.git/': error setting certificate verify locations:
  CAfile: E:/Softwares/Git/mingw64/libexec/ssl/certs/ca-bundle.crt
  CApath: none

There is no ssl folder in libexec

libexec folder

Also no file/folder changed in Git folder since Jan 2017

enter image description here

It seems like git-bash issue, not sure. Can anyone help ?

Upvotes: 36

Views: 112625

Answers (9)

SymboCoder
SymboCoder

Reputation: 147

I had the same issue, though in MAC. Usually, its a hidden folder so you will have to first ensure that you have got all hidden folders in the location displayed:

E:/Softwares/Git/mingw64/libexec

Once you find the file, just delete the entry in the file which starts from & anything related to ca.cert

[http]

Once, you have done that then set the below

git remote set-url origin 'https://github.com/junaidbinsarfraz/repo.git/'

Upvotes: 0

Antonio
Antonio

Reputation: 1

Check if git is installed. git --version

Install git.

Upvotes: -4

Aditya Singh
Aditya Singh

Reputation: 31

Fix

git config --global --replace-all http.sslcainfo "E:\Program Files\Git\usr\ssl\certs\ca-bundle.crt"

Upvotes: 3

Mads Lundwall
Mads Lundwall

Reputation: 11

For windows i found the same error having cloned successfully using GitHub desktop . When I tried doing a sync using Visual Studio, the error appeared.

My GitHub desktop runs 64 bit, but it has its git folder was placed in the Program (x86) folder (why?) The VS is also a 64 bit application, but has the certicate more naturally in the Program folder.

Solution: I copied content of C:\Program Files (x86)\Git\mingw32\ssl to C:\Program Files\Git\mingw64\ssl

And the Git of VS worked perfect

Upvotes: 1

Asad
Asad

Reputation: 508

One of my team member came to my seat with this error and I have identified that git was not installed on the system that's why he was getting this error.

Although Microsoft does suggest to install Git for Windows but you don't have to install it for the Visual Studio 2013 or 2017 as the same page ends with:

Visual Studio offers a great out of the box Git experience without any additional tooling. Learn more in our Visual Studio Git tutorial.

Git comes as an optional component for Visual Studio 2019 ,and you need to manually install it to work with Git servers such as Team Foundation Services, GitHub, and BitBucket. You can find more details about this here

Upvotes: -1

Vishal
Vishal

Reputation: 634

In my case, on windows, It was not working after setting of name, e mail as well as certificates path for git config. following command run from command prompt fixed this issue.

git config --global http.sslcainfo "C:\Program Files\Git\usr\ssl\certs\ca-bundle.crt"

path of your ca-bundle.crt may vary in your case.

Upvotes: 46

Nathan Mills
Nathan Mills

Reputation: 2279

On openSUSE 15.2 WSL (Windows Subsystem for Linux), I fixed this error by:

sudo update-ca-certificates 
sudo mkdir -p /etc/pki/tls/certs/
sudo cp /etc/ssl/ca-bundle.pem /etc/pki/tls/certs/ca-bundle.crt  

/etc/pki/tls/certs/ca-bundle.crt was the certificate file mentioned in the error. I noticed the file was missing. The full error in my case was:

fatal: unable to access 'https://github.com/vim/vim.git/': error setting certificate verify locations:
  CAfile: /etc/pki/tls/certs/ca-bundle.crt
  CApath: none

Upvotes: 2

Gaurav Kumar
Gaurav Kumar

Reputation: 115

Solution:

git config --global http.sslverify "false"

This command, Then your usual git clone "url" thing.

It can cause trouble in future to pull/push the secure repository. So disable at your risk.

Upvotes: -2

VonC
VonC

Reputation: 1324208

First, creating ssh keys won't help for an HTTPS url.
Keep those keys, but if you want to use them, you would need to put existing ssh keys to your github account then

 cd /path/to/your/repo
 git remote set-url origin [email protected]:junaidbinsarfraz/repo.git
 git push

Second, regarding the cert error, try to push from a simple CMD, using a simplified PATH as I do here, with said PATH referencing the very latest Git for Windows.
For that, uncompress PortableGit-2.16.1-64-bit.7z.exe anywhere you want.

Upvotes: 11

Related Questions