Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins Git integration - How to disable SSL certificate validation

I am getting the below error while creating a job from Jenkins. How do I disable certificate validation in Jenkins?

From Git Bash I can use git config --global http.sslVerify false command to disable it, but not sure how to use it from Jenkins.

Error:

Failed to connect to repository : Command "C:\Program Files (x86)\Git\cmd\git.exe ls-remote -h url ofmy repository.git HEAD" returned status code 128:
stdout:
stderr: fatal: unable to access 'url of my git/': SSL certificate problem: self signed certificate in certificate chain
like image 389
Sona Shetty Avatar asked Jan 30 '17 07:01

Sona Shetty


People also ask

How do I turn off certificate verification in git?

Prepend GIT_SSL_NO_VERIFY=true before every git command run to skip SSL verification. This is particularly useful if you haven't checked out the repository yet. Run git config http. sslVerify false to disable SSL verification if you're working with a checked out repository already.

How do I disable SSL self-signed certificate?

Select Self-signed Certificates to open it. Go to the certificate that you want to remove and click the trash bin icon to remove the certificate.

How do I skip SSL verification in curl?

To ignore invalid and self-signed certificate checks on Curl, use the -k or --insecure command-line option. This option allows Curl to perform "insecure" SSL connections and skip SSL certificate checks while you still have SSL encrypted communications.


1 Answers

Best option is to add the self-signed certificate to your certificate store

Obtain the server certificate tree This can be done using chrome.

  1. Navigate to be server address. Click on the padlock icon and view the certificates. Export all of the certificate chain as base64 encoded files (PEM) format.

  2. Add the certificates to the trust chain of your GIT trust config file In Git bash on the the machine running the job run the following:

"git config --list".

find the http.sslcainfo configuration this shows where the certificate trust file is located. 3. Copy all the certificates into the trust chain file including the "- -BEGIN- -" and the "- -END- -". Make sure you add the ROOT certificate Chain to the certificates file

This should solve your issue with the self-signed certificates and using GIT.

NOT RECOMMENDED

The other way is to remote into your slave and run the following:

git config --global http.sslVerify false

This will save into the global config that this instance never does SSL verification, this is NOT recommended, it should be used only when testing and then disabled again. It should be done properly as above.

like image 127
JamesD Avatar answered Oct 05 '22 18:10

JamesD