Github: error cloning my private repository
Asked Answered
P

27

174

I'm trying to clone my GitHub project using the https-URL, but it fails with an error:

$ git clone https://[email protected]/foo/foo-private.git
Cloning into foo-private...
Password:
error: error setting certificate verify locations:
  CAfile: /bin/curl-ca-bundle.crt
  CApath: none
 while accessing https://[email protected]/foo/foo-private.git/info/refs

fatal: HTTP request failed

What am I doing wrong?

Prussiate answered 23/9, 2010 at 11:51 Comment(0)
O
315

I have seen this on Windows, with msysgit 1.7.2.3. You have to fix the path to bin/curl-ca-bundle.crt. I had to specify the absolute path, using back-slashes:

git config --system http.sslcainfo "C:\Program Files (x86)\git\bin\curl-ca-bundle.crt"

This will result in changes to [git-install-dir]/etc/gitconfig file, which may be edited directly, too.

(Original solutions found at http://github.com/blog/642-smart-http-support)

Oquendo answered 23/9, 2010 at 12:17 Comment(11)
In my case I needed to use the directory delimiter for windows, i mean, i have to use the "\" (windows) instead of "/" (unix) for separating directories in the path.Palaver
As original post writing below works for me Try it out on a public repository: $ git clone github.com/schacon/grack.git For private repos, or to have push access on your repository, you can clone this way: $ git clone [email protected]/username/project.git Thanks :)Phlegm
Make sure that you look into Program Files and Program Files (x86) ! Bloody WindowsHandtohand
For future references the path seems to have changed for me to "C:\Program Files (x86)\Git\mingw32\ssl\certs\ca-bundle.crt"Sharpnosed
Not working for me ...please suggest something..Cloning the MEAN repo....... Error: Command failed: git clone --branch v0.4.2 github.com/meanjs/mean. git mean Cloning into 'mean'... fatal: unable to access 'github.com/meanjs/mean.git': error setting cer tificate verify locations: CAfile: /mingw64/ssl/certs/ca-bundle.crt CApath: nonePlasterboard
The path on my 64 bit machine is "C:\Program Files\Git\mingw64\ssl\certs\ca-bundle.crt"Alcot
I just want to point out that setting http.sslverify false is not recommended and the answwer should be updated to reflect this.Dustproof
The answer says ".. -- not really recommended -- ..." already.Oquendo
On my 64 bit machine, git config --global http.sslcainfo "C:\Program Files\Git\mingw64\ssl\certs\ca-bundle.crt" worked, can't say why global while system failed.Snowwhite
Why does curl fail?, fixed mine!Salmanazar
I have added git config --system http.sslverify false and it STILL gives me the error setting certificate verify locations error. Nothing requiring internet works from git bash but Windows cmd has no problems.Yulandayule
R
95

I solved the problem installing Git from: https://git-for-windows.github.io/

Locate the cert file path:

D:\Program Files\Git\mingw64\ssl\certs\ca-bundle.crt

Configure the Git path:

git config --system http.sslcainfo "D:\Program Files\Git\mingw64\ssl\certs\ca-bundle.crt"

Try again

Rawlings answered 26/10, 2015 at 0:16 Comment(5)
I got error: could not lock config file C:\Program Files\Git\mingw64/etc/gitconfig: Permission denied. Ran "C:\Program Files\Git\git-bash.exe" as administrator and tried again and it worked. Thanks!Zebada
Better ExplainationPsychodiagnostics
I've just installed Git for Windows 2.13.2 and ran into this problem trying to push to the remote. I found the cert file was in a similar location: C:\Program Files\Git\mingw64\ssl\certs\ca-bundle.crtLancashire
this worked for me, I only installed the Git using the link u shared and that solved it for me, ThanksHanshansard
I had installed GIT on a specified directory during installation time, hence I had to specify the correct MINGW64 path as per that installationPavia
E
26

If you use MSYS2...

Just install the certificate packages with the following commands:

32 bits

pacman -S mingw-w64-i686-ca-certificates ca-certificates

64 bits

pacman -S mingw-w64-x86_64-ca-certificates ca-certificates
Espresso answered 18/4, 2015 at 22:29 Comment(6)
Plus One. Thanks. Don't recall having to do this msys2 32bit, but the circumstances might differ.Willms
Thank you, I confirm this is the thing to do using msys2 64 bits :-DShy
It may occurs the /usr/ssl/certs/ca-bundle.crt file is empty, just re-install ca-certificates againNeotropical
Not for Windows: $ pacman -S mingw-w64-x86_64-ca-certificates ca-certificates bash: pacman: command not foundMaeda
@Javix That's why it says "If you use MSYS2". The pacman command is not available by default on Windows, but it is available if you have MSYS2 installed.Espresso
Worked for me. Thanks.Overkill
P
12

If you were using Cygwin, you might install the ca-certificates package with apt-cyg:

wget rawgit.com/transcode-open/apt-cyg/master/apt-cyg
install apt-cyg /usr/local/bin
apt-cyg install ca-certificates

How do I install a cygwin package from the command line?

Pig answered 13/5, 2013 at 1:55 Comment(2)
Damn. I searched so long. This worked out also on mac. Thank you for sharing.Librettist
On Cygwin it worked for me git config --system http.sslcainfo /usr/ssl/certs/ca-bundle.crtKilmarnock
T
12
git config --global http.sslverify "false" 

Will solve the problem. After that a Pop-up window appears to enter your username and password

Tram answered 13/9, 2017 at 19:43 Comment(2)
You might want to mention the security ramifications of this. This seems like a terrible idea, particularly globally.Troutman
Worked on HPC for meCheiron
D
6

SOLVED: I got this error when I installed an update to the Git windows installer. What happened is that I did not install it with administrator rights, so Git was installed in "C:\Users\my_name\AppData\Local\Programs" instead of "C:\program Files". re-installing Git as administrator allowed to put it in C:\program Files and everything went fine again !

Disquiet answered 14/12, 2015 at 12:35 Comment(1)
For what it's worth, uninstalling and reinstalling GitHub Desktop fixed this for me too, despite it still using the AppData folder.Seine
D
5

This worked for me (I'm using Manjaro linux). I run the cmd to view ca-certificates:

$ curl-config --ca
**/etc/ssl/certs/ca-certificates.crt**

But actually i found the certificates at the path:

**/etc/ca-certificates/extracted/ca-bundle.trust.crt**

Then add the config into ~/.gitconfig (if not existing, create it):

**vim ~/.gitconfig**
[http]
    sslVerify = true
    sslCAinfo = /etc/ca-certificates/extracted/ca-bundle.trust.crt

[user]
    email = <email of github account>
    name = <username of github account>

It works!

.rbenv]$ git pull

remote: Counting objects: 70, done.
remote: Compressing objects: 100% (47/47), done.
remote: Total 70 (delta 39), reused 12 (delta 12), pack-reused 6
Unpacking objects: 100% (70/70), done.
From https://github.com/sstephenson/rbenv
   c43928a..efb187f  master     -> origin/master
 + 37ec781...7e57b52 user-gems  -> origin/user-gems  (forced update)
Updating c43928a..efb187f
Fast-forward
 libexec/rbenv-init         |  4 ++--
 libexec/rbenv-version-file |  1 +
 test/init.bats             |  2 +-
 test/test_helper.bash      | 25 +++++++++++++++----------
 4 files changed, 19 insertions(+), 13 deletions(-)
Deryl answered 11/10, 2015 at 2:55 Comment(1)
Worked for me on archlinux!Orangery
G
4

git config --system http.sslcainfo /bin/curl-ca-bundle.crt

This works. You don't have to give full path.

Galway answered 19/2, 2014 at 9:49 Comment(0)
H
3

I faced this while git pull. For mine edited the global git config file that fixed problem.

Goto your home folder and open .gitconfig file. Usually C:\Users\.gitconfig

If the file is not there create it

[http]
sslcainfo = E:\systools\git-1.8.5.2\bin\curl-ca-bundle.crt

There you have to given your own git installation path. I have used portable version of git here.

Then git clone / pull it will work.

Hunkydory answered 20/2, 2014 at 1:11 Comment(2)
You need to use double escape chars: E:\\systools...Kinakinabalu
BUT, be sure NOT to wrap the path in quotes. super-counter-intuitive. "C:\\folder\\file" is bad, C:\\folder\\file is good. I want my hour back.Rotation
T
3

In my win10 case I have two versions of .gitconfig

  • the first one is in C:\Program Files\Git\etc
  • the second is in C:\Users\<user>

The command

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

indeed makes changes to C:\Program Files\Git\etc, but git somehow uses config in C:\Users\<user>

So with notepad I changed the second one .gitconfig and git finally took right configuration and got working.

Teriann answered 9/1, 2020 at 13:41 Comment(1)
Thanks. I had same issue and found what you said. Setting cert with git config --global was not setting the path correctly in C:\Users\<user> so I had to update it manually and issue was fixed.Timi
S
2

If you are using the Git command shell that installs with the GitHub for Windows app then this and various other problems can show after an update. Just start the Git Hub windows app and shut it down again. The shell will then work OK again. The problem is that the update does not complete until the windows application is run. Just using the shell on its does not trigger the update to complete.

Shock answered 4/4, 2016 at 15:24 Comment(0)
I
2

I've seen this on my Github for Windows.

I recommend uninstalling Github for Windows and installing it again.

Before this, I tried several ways with no success, but this solution worked for me!

Irena answered 12/4, 2016 at 23:26 Comment(0)
S
2

In my case, the solution to the problem was to change openssl to schannel:

Before

PS E:\www\XXXXX> git config --global http.sslverify "true"
PS E:\www\XXXXX> git pull origin main --force
fatal: unable to access 'https://gitlab.com/XXXXXXXXX.git/': error setting certificate verify
locations: CAfile: C:\Program Files\Git\mingw64\ssl\certs CApath: C:\Program Files\Git\mingw64\ssl\certs

Solution

PS E:\www\XXXXX> git config --global http.sslbackend schannel

After

PS E:\www\XXXXX> git config --global http.sslverify "true"

PS E:\www\XXXXX> git pull origin main --force

From https://gitlab.com/XXXXXXXXX
  * branch main -> FETCH_HEAD
Already up to date.

It would look like this in C:\Program Files\Git\etc\gitconfig

[http]
sslBackend = schannel
sslcainfo = C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
Sulfide answered 31/7, 2022 at 21:38 Comment(0)
C
1

On Windows using msysgit I had this error and the cause was my additions of our corporate proxy certificates.

If you edit your curl-ca-bundle.crt you have to get sure about your lineendings. In case of the curl-ca-bundle you have to use Linux-Style lineendings.

> git ls-remote --tags --heads https://github.com/oblador/angular-scroll.git
fatal: unable to access 'https://github.com/oblador/angular-scroll.git/': error setting certificate verify locations:
  CAfile: C:\Program Files (x86)\Git\bin\curl-ca-bundle.crt
  CApath: none

You can use notepad++ to convert the lineendings to Linux (linefeed).

Carnauba answered 26/6, 2015 at 7:11 Comment(0)
P
1

On a side note, this issue can happen in Windows if the user who is trying to use git is different than the user who installed it. The error may indicate that git cannot access the certificate files. Installing git as the administrator and using @rogertoday's answer resolved my issue.

Paule answered 2/12, 2015 at 17:43 Comment(0)
L
1

I found a good solution for adding/updating the CA certificates on RHEL/CentOS 6 which is the root cause reported issue.

Since they become outdated distros, the cacert authorities in that system has not been updated until executing the command sudo yum update.

Didn't realize the issue until the GIT_CURL_VERBOSE mode shows the cacert path issue.

Lauds answered 27/7, 2016 at 8:1 Comment(0)
I
1

I encountered this error after updating to Visual Studio 2019 16.10.2 (from 16.10.0), whereas previously Git was working correctly.

I do not have Git installed separately. (Or, put another way, I only use Git as part of Visual Studio.)

I solved this problem by locating the file "ca-bundle.crt" at "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git\mingw32\ssl\certs\ca-bundle.crt", and then copying it to the folder it was indicating it couldn't be found at, "C:\Program Files\Git\mingw64\ssl\certs\ca-bundle.crt".

Do note that I had to create the "\mingw64\ssl\certs" directories, as they did not previously exist.

After copying the file there, Git was able to sync once again immediately without restarting Visual Studio.

Indicative answered 16/6, 2021 at 20:39 Comment(0)
V
0

On Linux, I had this error and fixed it by running sudo update-ca-certificates.

Ventose answered 12/6, 2015 at 6:37 Comment(1)
You should explain what this command does and why this helps. Posting raw commands without explanation is not a good idea, specially if you need root access.Elseelset
E
0

If anybody else is facing this issue in Git for Windows and do not have curl-ca-bundle.crt anywhere on your system even after reinstalling, this is the process I followed:

  1. Download the latest version of curl here: curl download mirror
  2. Extract and navigate to curl-**.**.*/lib in the command line
  3. Run ./mk-ca-bundle.prl
  4. Copy ca-bundle.crt to your git path and update the config as listed in other answers

Shout out to this gist for helping me get the installation done.

Epicedium answered 4/7, 2018 at 16:13 Comment(0)
N
0

I've solved this problem on a Windows Server 2016 by reinstalling it and by choosing "native Windows Secure Channel library" on the "Choosing HTTPS transport backend" install step.

Nonce answered 8/11, 2018 at 16:46 Comment(0)
F
0

For MinGit users on Windows 10:

You'll have to make slight adjustments to @mstrap's answer.

git config --system http.sslcainfo "<PATH-TO-MINGIT>\mingw64\ssl\certs\ca-bundle.crt"
Frantz answered 18/3, 2021 at 12:13 Comment(0)
Z
-1

For me what solved the problem was when on my windows 10 box, I tried uninstalling git and resintalling, using Windows Cmd as default not Git Bash

Open CMD and run the following

//Once installed try to resintall the bin folder 
git config --system http.sslcainfo \bin/curl-ca-bundle.crt

//disable ssl verification
git config --global http.sslverify "false"

//Then try to clone repo again
git clone [email protected]:account/someproject.git
Zwart answered 25/2, 2017 at 21:5 Comment(0)
H
-1

I received this error after moving git across hard drives. Deleting and reinstalling in the new location fixed things

Hillegass answered 22/3, 2018 at 9:28 Comment(0)
S
-1

On git for Windows you can also reinstall and select the Windows native certificate validation method (OpenSSL is default). This will skip the OpenSSL verification and instead use the Windows native one, which doesn't require maintaining a separate tool (OpenSSL) and certificates.

Worked perfectly for me :)

Staphylorrhaphy answered 16/8, 2018 at 14:39 Comment(0)
B
-1

The solution that work for me in windows 64bits is the following

git config --system http.sslverify false

Blearyeyed answered 22/3, 2019 at 17:8 Comment(0)
A
-2

The following command

git clone git://github.com/username/projectname.git

worked for my needs, but I assume you want more than read-only access, right?

Altamirano answered 26/7, 2011 at 0:24 Comment(0)
U
-2

I was able to solve this issue with the following command.

git config --system http.sslverify false

Undergird answered 10/3, 2016 at 7:47 Comment(1)
This answer would be better if it discussed the security ramifications of this setting and provided other ways of solving the problem as well. Though, the current accepted answer does this and more...Bree

© 2022 - 2024 — McMap. All rights reserved.