Quick Fix for Git's "Error Setting Certificate File" Issue
Have you anytime got an error regarding git while uploading files to remote repo via git from your system about setting certificate file? Use case :-) I've just experienced this & let me tell you, I've just ran the PUSH command of git: git push -u origin main The exact error I've got was: error: unable to access 'https://github.com/nitinkumar30/BDD-allure-test-project.git/': error setting certificate file: C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt The file actually didn't exists & need to put it inside. Also, when I've checked the certificate file - ca-bundle.crt, it was present in another location. Solution :-) The specified file ca-bundle.crt should be present & your git should pointing to that certificate while connecting/interacting with the remote repo. But, while pushing code, we're getting file isn't present in the specified directory. It's present in another directory. So, we can point our git to new directory where that certificate is present. I've tried searching & got it in the directory - C:/Program Files/Git/usr/ssl/certs/ca-bundle.crt instead of C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt . We can directly do this using following git command of git config : git config --global http.sslCAInfo C:\Program Files\Git\usr\ssl\certs\ca-bundle.crt This'll direct it to the certificate file for git. But but but wait, here's a catch. Now, git is directing that certificate to both the locations right? How to remove the old redirected directory for bundle certificate? We've a command to delete/unset all old certificate bundle directory. git config --global --unset-all http.sslCAInfo And, to check all the locations where this certificate is directing, we can check with following git command: git config --global --get-all http.sslCAInfo But one more problem here, when we're running our file again to push, we're getting another error: error setting certificate file: C:/Program Why so? Because of the space between the command 'Program' & 'Files' although it's a folder name, it'll take it as 2 different entities. Now to resolve it, we'll edit the command like this: git config --global http.sslCAInfo C:/Program\ Files/Git/usr/ssl/certs/ca-bundle.crt ; '\' will ignore the space between 'Program' & 'Files'. Hence, will run as expected. You can now check all the set paths of certificate bundle. Hope this helped you, in case you've got this error anytime during your git. It's a small yet typical error one gets who might take whole day to debug. I'm btw, using PyCharm Community to run & connect to my github repo directly.

Have you anytime got an error regarding git while uploading files to remote repo via git from your system about setting certificate file?
Use case :-)
I've just experienced this & let me tell you, I've just ran the PUSH command of git:
git push -u origin main
The exact error I've got was:
error: unable to access 'https://github.com/nitinkumar30/BDD-allure-test-project.git/': error setting certificate file: C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
The file actually didn't exists & need to put it inside. Also, when I've checked the certificate file - ca-bundle.crt, it was present in another location.
Solution :-)
The specified file ca-bundle.crt should be present & your git should pointing to that certificate while connecting/interacting with the remote repo. But, while pushing code, we're getting file isn't present in the specified directory. It's present in another directory.
So, we can point our git to new directory where that certificate is present. I've tried searching & got it in the directory - C:/Program Files/Git/usr/ssl/certs/ca-bundle.crt instead of C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt .
We can directly do this using following git command of git config
:
git config --global http.sslCAInfo C:\Program Files\Git\usr\ssl\certs\ca-bundle.crt
This'll direct it to the certificate file for git.
But but but wait, here's a catch. Now, git is directing that certificate to both the locations right? How to remove the old redirected directory for bundle certificate?
We've a command to delete/unset all old certificate bundle directory.
git config --global --unset-all http.sslCAInfo
And, to check all the locations where this certificate is directing, we can check with following git command:
git config --global --get-all http.sslCAInfo
But one more problem here, when we're running our file again to push, we're getting another error:
error setting certificate file: C:/Program
Why so?
Because of the space between the command 'Program' & 'Files' although it's a folder name, it'll take it as 2 different entities.
Now to resolve it, we'll edit the command like this:
git config --global http.sslCAInfo C:/Program\ Files/Git/usr/ssl/certs/ca-bundle.crt
; '\' will ignore the space between 'Program' & 'Files'. Hence, will run as expected.
You can now check all the set paths of certificate bundle.
Hope this helped you, in case you've got this error anytime during your git. It's a small yet typical error one gets who might take whole day to debug.
I'm btw, using PyCharm Community to run & connect to my github repo directly.