问题
$ git pull origin master
fatal: unable to access 'https://xxxxxxxxxxxxxxx':
error setting certificate verify locations:
CAfile: C:/Users/abc/AppData/Local/Programs/Git/usr/bin/curl-ca-bundle.crt
CApath: none
I am getting this error when I pull or push my code.
Please guide me to fix this.
回答1:
I was also facing this problem in windows and running git using gitbash. I just reinstalled gitbash, And gitbash automatically managed git certificate and its path needed.
回答2:
When using https
you will need to supply password or using a certificate.
In your case looks like the certificate is not a valid one.
Try fixing it like this by telling git where to find the certificate:
// Add the certificate to your configuration file
git config --system http.sslcainfo "C:\Program Files (x86)\git\bin\curl-ca-bundle.crt"
Alternatively, you could disable SSL checks:
// or switch off SSL checks completely by executing:
git config --system http.sslverify false
Set this in your config to disable it only for the given url and not for all requests
[http "https://weak.example.com"]
sslVerify = false
http.sslVerify
Whether to verify the SSL certificate when fetching or pushing over HTTPS.
http.sslCAInfo
File containing the certificates to verify the peer with when fetching or pushing over HTTPS
回答3:
I once had the same problem. My problem occured after re-installing git for windows. I'm using git for windows 64-bit on windows 10.
I found out that the installer did not install git anymore in C:/Users/[USER_NAME]/AppData/Local/Programs/Git
. Instead it installed it under
C:\Program Files\Git
.
Nevertheless the old config file C:\ProgramData\Git\config
was not edited by the installer. This file still contains the old path so I edited it manually.
E.g. on my system I used
[http]
sslCAInfo = C:/Programme/Git/mingw64/ssl/certs/ca-bundle.crt
maybe you will have to use Program Files
instead
sslCAInfo = C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
EDIT
Like DS said in his comment
C:\ProgramData\Git\config needs to be edited as Administrator.
E.g. right click on notepad and select "Run as Administrator" then open the file.
回答4:
In version 2.x of git-bash The path to the .crt has changed to ../Git/mingw64/ssl/certs/ca-bundle.crt. I had to update this manually in git-bash with
git config --global http.sslcainfo "/path/to/Git/mingw64/ssl/certs/ca-bundle.crt"
回答5:
Try this
git config --system http.sslcainfo "C:\Program Files (x86)\git\bin\curl-ca-bundle.crt"
or
Switch off your SSL by running this command
git config --system http.sslverify false
回答6:
git config --global http.sslverify "false"
- will solve the problem after that Pop-up window appear to enter your username and password make sure valid .
回答7:
If your git version is 2.8.1.windows.1,this may help you. First , you need to locate your git home directory,mine is D:\SDK\Git.Just in the same directory,you can find folder "usr",open it and goes to \ssl\certs,you can find the certificate:ca-bundle.crt.
Then open console,execute:git config --system http.sslcainfo "D:\SDK\Git\usr\ssl\certscabundle.crt"
回答8:
This will do the work while moving from GIT 2.x clients to 2.5.x:
Looks like after installing a new version of GIT client, it changes the path it looks for certificates from something like this:
C:\Program Files\Git\mingw64
to something like this:
C:\Program Files\Git\mingw64\libexec
To fix this, just copy the 'ssl' folder to the new location and it'll work like a charm!
回答9:
Go your git directory and move the mingw64/ssl folder to mingw64/libexec/ssl
回答10:
For future readers:
I was having this problem after installing devel packages on cygwin.
I tried all of the fixes in this thread but nothing was working
Then, I ran into this thread on github
What I did was I found where CAPATH was being specified in gitconfig, and I deleted that https specification, and it solved my issue.
回答11:
I got the same problem after my latest update of cygwin after installing Windows 10.
The command update-ca-trust
failed during installation.
The reason seem to be that the group owner for the certificate folder was corrupt.
The somewhat drastic solution was to delete /etc/group
, it turned out that cygwin is able to ask windows directly about group rights.
Solution found at http://zaunerc.blogspot.se/2016/01/cygwin-mapping-windows-sids-to-posix.html
回答12:
I found the ssl certificate at :
C:\Users\[USERNAME]\AppData\Local\GitHub\PortableGit_[portable code]\usr\ssl\certs
then you can follow solution by CodeWizard i.e. :
// Add the certificate to your configuration file
git config --system http.sslcainfo "[LOCATION_SPECIFIED_ABOVE]/cabundle.crt"
回答13:
Current Git for Windows build (2.18.0.windows.1) has a bug -- if the http.sslcainfo is not set it expects to find the certificate store in C:/Program Files/Git/mingw64/libexec/ssl/certs/ca-bundle.crt
.
Certificate store is actually installed to C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
so to fix that you must specify the proper path.
Furthermore, the SCHANNEL implementation is also broken in this build.
Finally, Git credential manager is also broken because if you have CI/CO credentials stored from gitlab-runner installation it will fail to clone/push/pull with access denied error instead of prompting for different credentials.
回答14:
This thread is a lot of blind-leading-the-blind answers. I'm just one more blind man here, but I just had the same issue and solved it by following this easy article. As I understand the original question, git is trying to find an SSL cert file in order to use the HTTPS protocol, and failing to find the file. Most of the answers here seem to focus on "well, just disable SSL then," rather than replacing the file correctly.
This incantation should generate the cert file and put it in the correct location for git on cygwin:
$ curl -sL http://ca.pdinc.us > /etc/pki/ca-trust/source/anchors/ca.pdinc.us.pem \
&& update-ca-trust
In case you monkeyed with your git config (like I did) and need to set it BACK, this should do it:
$ git config --global http.sslcainfo "/etc/pki/ca-trust/extracted/openssl/ca-bundle.trust.crt"
One other side note which could be impacting many of the people reading this thread: The expected location of the cert file depends on which git executable you're running. Since we're talking about Cygwin, some (most?) of us probably have a Windows-native flavor of git installed too. If your Cygwin paths are set up to find the Windows git executable, your mileage may vary in terms of where to point the http.sslcainfo
configuration. To check which executable is getting picked up for you:
$ which git
回答15:
Using Intellij and git-sdk-64, and picked git-sdk-64\mingw64\bin\git.exe
at first to be getting this issue, then when switched to git-sdk-64\cmd\git.exe
it figured the cert file location alone and no other configuration was needed. (have not used git config --global http.sslcainfo ...
)
回答16:
I have found the following steps useful in fixing the issue at my end for Windows 10:
Doing an uninstall of git.
However, git uninstaller doesn't do a clean job. So you may need to go delete the Git directory at C:\Users[My name]\AppData\Local\Programs\
After this, a fresh install of git should install install it in the C:\Program Files\Git directory where the config file points to in order to read the ssl certificate.
回答17:
I had the same error and I fixed it reinstalling git in the default path:
C:\Program Files\Git
That's all
回答18:
I've got the same error message but in my case it was because I've changed github settings to use ssh instead of https.
And the repository with the problem was cloned with https after removing the remote and re-adding it with ssh it's working as expected.
$git remote remove origin
$git remote add origin git@github.com:UserName/repo.git
Then git remote show origin
is correctly showing the remote.
回答19:
I got the same error in Windows 7. Found that the certificate path referred in the error was not existing. Instead of ...\mingw32\usr\ssl... the cert file was in ...\mingw2\ssl... So I created a usr folder manually and moved the entire ssl tree into usr. This fixed the issue.
回答20:
Thanks to https://github.com/npm/npm/issues/1484git config --global http.sslverify "false"
will solve the problem
回答21:
I ran into the same error message but while cloning a github repository, unfortunately setting the http.sslcainfo
didnt quite help. As I happened to be behind a corporate proxy server, setting the http.proxy
fixed it for me.
回答22:
I have the similar problem, but uninstalling gitbash and reinstalling to the system, worked for me.
来源:https://stackoverflow.com/questions/34510018/unable-to-pull-push-in-git-repository