Resolves an issue where Git accesses a remote self-signed repository - SSL certificate problem

Many companies use Git to build private repositories within their companies, and in order to improve the security of data transmission, they use Https to provide services, and for various reasons, they use self-signed methods on the server side. This will result in an error when accessed from the client: “SSL certificate problem: self singed certificate”, resulting in the operation not being completed.

  1. Globally disable validation (not recommended)

To solve this problem, the easier way to set git to verify the certificate at global scope (all items natively) is to use the following command:

1
git --global config http.sslVerify false

But this may lead to other security issues.

  1. Prohibited in a single project

When operating on a self-signed repository, always add the parameter “-c http.sslVerify=false”, for example, to clone a repository, execute:

1
git -c http.sslVerify=false clone https://your-domain/repos

To upload to a remote repository, execute:

1
git -c http.sslVerify=false push

In a single project that has been cloned locally, you can also disable the validation of certificates at project scope by executing the config command,Go to the project directory and execute:

1
git config http.sslVerify false
  1. In IDE

In the IDE (e.g. Intellij IDEA), if you have cloned the source library with the “-c http.sslVerify=false” parameter (this step needs to be done at the command line), you can do so in the project directory:

1
git config http.sslVerify false

This allows you to disable certificate validation in a single library, so that you can complete subsequent version management operations through the relevant menus of the IDE.

本文标题:Resolves an issue where Git accesses a remote self-signed repository - SSL certificate problem

文章作者:Morning Star

发布时间:2022年01月07日 - 15:01

最后更新:2022年01月07日 - 15:01

原始链接:https://www.mls-tech.info/git/git-self-signed-cert-en/

许可协议: 署名-非商业性使用-禁止演绎 4.0 国际 转载请保留原文链接及作者。