Jenkins Git plugin with https

后端 未结 11 2221
Happy的楠姐
Happy的楠姐 2020-12-30 05:20

I am trying to configure a Git project in Jenkins using the Git plugin. In the project configuration page I enter the repository URL in the Git configuration, which is an ht

11条回答
  •  难免孤独
    2020-12-30 05:48

    In case you're using a self-signed certificate for your Git repository and Git works from command line but not from Jenkins Git Client plugin, you need to add the certificate to the Jenkins Java Keystore (as described by tijs in the comment above).

    This is because Git Client plugin tries to connect directly using Java's Apache HttpClient (bypassing git.exe), so all Git settings normally used to create the connection are ignored (including GIT_SSL_NO_VERIFY and certificates in curl-ca-bundle.crt). The HttpClient throwsSunCertPathBuilderException: unable to find valid certification path to requested target which is unfortunately wrapped in a GitException without stack trace, so all we can see is 'Failed to connect' message.

    In order to fix it you can follow the link provided by tijs: http://www.mkyong.com/webservices/jax-ws/suncertpathbuilderexception-unable-to-find-valid-certification-path-to-requested-target/

    You would need to copy the resulting jssecacerts file to C:\Program Files (x86)\Jenkins\jre\lib\security if you're using default Jenkins installation.

    You can find a link to InstallCert.java in the original Andreas Sterbenz post (thanks to web.archive.org), or a slightly modified version at code.google.

    I checked the above approach works for Git Client plugin version 1.4.6.

提交回复
热议问题