【Git】How to fix git clone failing due to SSL certificate problem

Git
スポンサーリンク

About the issue

When I tried to create a test environment and ran git clone.

# git clone -b branch-name https://source-server/path/to/repo.git /var/www/html/clone-folder-name

The following error occurred, causing git clone to fail.

# git clone -b branch-name https://source-server/path/to/repo.git /var/www/html/clone-folder-name
Cloning into '/var/www/html/clone-folder-name'...
fatal: unable to access 'https://source-server/path/to/repo.git/': SSL certificate problem: unable to get local issuer certificate

SSL certificate error has occurred.
Now, what should I do…

Solution

It seems that the issue can be avoided by setting SSL verification to false.

# git config --global http.sslVerify false

Alternatively, SSL verification can be disabled by adding the following to .gitconfig.

[http]
   sslVerify = false

Although there are doubts about whether disabling SSL verification is truly appropriate, this method seems to be commonly used.
Ideally, proper measures should be taken, but since this is a test environment, we have adopted this method.

タイトルとURLをコピーしました