Git Clone 报错 `SSL certificate problem: unable to get local issuer certificate`

If you get "SSL certificate problem: unable to get local issuer certificate" error when trying to clone a Git repository, it means that Git cannot verify the remote repository's SSL certificate. This can happen if the SSL certificate is self-signed, or if there is a problem with the SSL certificate chain.

$ git clone https://github.com/fatedier/frp.git
Cloning into 'frp'...
fatal: unable to access 'https://github.com/fatedier/frp.git/': SSL certificate problem: unable to get local issuer certificate

To fix this error, try the following solutions:

1. Disable SSL verification:

This is generally not recommended as it makes the system more vulnerable to security risks, but you can disable SSL verification and clone the repository with the following command:

   git config --global http.sslVerify false

Add the SSL certificate to Git's trusted certificates:

You can download an SSL certificate from a remote repository and add it to Git's trusted certificates with the following command:

   git config --global http.sslCAinfo /path/to/certificate.crt

/path/to/certificate.crtReplace with the downloaded SSL certificate file

3. Update Git:

  • Linux

install dependencies

# Ubuntu / Debian 
apt get install libcurl4-gnutls-dev libexpat1-dev gettext libz-dev libssl-dev
# Centos
yum install libcurl4-gnutls-dev libexpat1-dev gettext libz-dev libssl-dev

Clone the Git repository

   git clone https://github.com/git/git.git

Enter the directory where you downloaded or cloned the Git source code to compile and install:

   cd git
   make prefix=/usr/local all
   sudo make prefix=/usr/local install
  • Windows
git update-git-for-windows

If it fails, you can install the latest version through Winget or go to the official Git download installation package to overwrite the installation

winget install git.git

insert image description here

Make sure you're using the latest version of Git, as newer versions may have better SSL verification.

4. Check your system clock:

If the system clock is set incorrectly, it may also cause SSL verification errors, please make sure the system clock is set to the correct date and time.

If none of these solutions work, it may be time to contact the owner of the remote repository for assistance, or try a different network or clone the repository.

Guess you like

Origin blog.csdn.net/no1xium/article/details/130578316