Description
When using git clone
to clone an item on GitHub or gitee, the following error is reported:
error setting certificate verify locations:
CAfile: E:/Git/mingw64/ssl/certs/ca-bundle. crt
CApath: none
analysis
According to the error prompt, there is an error in setting the certificate verification location, that is, the certificate file path is wrong.
When cloning a remote project, the security certificate will be verified first. If the local security certificate file cannot be found, an error will be reported.
This is why this error will not be reported when cloning projects on gitlab, because gitlab is generally built on the intranet and does not need to verify the security certificate.
Path errors often occur because the local Git is installed green, that is, it is directly extracted and used.
In this way, the path of the certificate file is still the path on the original machine. If the path of the new machine is inconsistent, the path error will be caused.
Solution:
For the above analysis, there are two solutions:
- Modify certificate file path (recommended)
- Turn off certificate verification
Turning off certificate verification may cause security problems. It is recommended to modify the certificate file path.
Modify certificate file path
There are two ways:
- Execute the configuration command (recommended)
- Modify the configuration file
The essence of these two methods is to modify the configuration file. However, some misoperations may occur when modifying the file, and the operation is more cumbersome. It is recommended to execute the configuration command.
Execute configuration command
git config --system http.sslcainfo "Git安装路径/mingw64/ssl/certs/ca-bundle.crt"
Modify profile
Git’s system configuration files are located at: git installation path \etc\gitconfig
Modify the path in the file as shown in the figure to git installation path /mingw64/ssl/certs/ca-bundle.crt
save again.
Turn off certificate verification
git config --system http.sslverify false
This method may cause git security problems and is not recommended.