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.
- 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.
- 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 |
- 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.