• Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • None
    • In this case: Jenkins 1.536 (Jenkins version doesn't really matter :) running on Linux(CentOS6.4) respectively MacOSX(Mavericks)
      Plugins: git v 2.0, git-client 1.4.6

      When using the git plugin 2.0 and git-client plugin 1.4.6 the connection to a remote git repository via https fails.
      Using a connection URL like https://<user>:<password>@<URL> I receive a "failed to connect" where the connection URL was reduced to https://<user>@<URL> - where of course was clear why it failed: The password wasn't submitted !?

      Reverting to versions 1.5.0 (git) respectively 1.0.7 (git-client) and a Jenkins restart solved it. Keeping one of both plugins on the newer version and only downgrading the other produced another symptom: The GIT was no longer available for configuration in Jenkins. So there's a dependency between both plugins.

      The "million-dollar-question" is: Is this a bug in those plugins? Or or do they simply need to be handled/configured differently. I didn't find any hint on this so far ..

          [JENKINS-20533] Git2 plugin and HTTP-authentication fails

          Juergen Klasen created issue -

          Coleman added a comment -

          Running into the same behavior on our Jenkins install using https://username:password@host URLs

          Coleman added a comment - Running into the same behavior on our Jenkins install using https://username:password@host URLs

          Mark Waite added a comment -

          The git plugin 2.0 now connects with the credentials plugin. You should be able to create a new credential in the "Manage Credentials" panel ( http://localhost:8080/credentials/? ), then use that credential for the https authentication with git plugin 2.0.

          Since this is the first release of the git plugin with support for the credentials plugin, the documentation is still sparse, but you may be able to infer how to use it without detailed documentation.

          Mark Waite added a comment - The git plugin 2.0 now connects with the credentials plugin. You should be able to create a new credential in the "Manage Credentials" panel ( http://localhost:8080/credentials/? ), then use that credential for the https authentication with git plugin 2.0. Since this is the first release of the git plugin with support for the credentials plugin, the documentation is still sparse, but you may be able to infer how to use it without detailed documentation.

          We are also experiencing this problem. I have found no way to get this working, even with assorted values in the credentials plugin. My best guess at the moment is that the plugin is unable to deal with self-signed SSL certificates... but since I don't have a non-self-signed certificate to switch to, I can't confirm.

          The only solution I've found is reverting all the way back to git 1.2.0 plugin as described at https://issues.jenkins-ci.org/browse/JENKINS-17204. Versions 1.3.0 through 1.5.0 failed with one error message; Version 2.0 continues to fail, although with a different error message:

          Started by user My Name
          [EnvInject] - Loading node environment variables.
          Building on master in workspace D:\Jenkins\jobs\test\workspace
          Fetching changes from the remote Git repository
          Fetching upstream changes from https://validusername@git.domainname.net/scm/SVC/devkit.git
          FATAL: Failed to fetch from https://validusername@git.domainname.net/scm/SVC/devkit.git
          hudson.plugins.git.GitException: Failed to fetch from https://validusername@git.domainname.net/scm/SVC/devkit.git
          	at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:612)
          	at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:836)
          	at hudson.plugins.git.GitSCM.checkout(GitSCM.java:861)
          	at hudson.model.AbstractProject.checkout(AbstractProject.java:1412)
          	at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:652)
          	at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:88)
          	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:557)
          	at hudson.model.Run.execute(Run.java:1679)
          	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
          	at hudson.model.ResourceController.execute(ResourceController.java:88)
          	at hudson.model.Executor.run(Executor.java:230)
          Caused by: hudson.plugins.git.GitException: Failed to connect to https://validusername@git.domainname.net/scm/SVC/devkit.git
          	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.getURLWithCrendentials(CliGitAPIImpl.java:1441)
          	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.fetch(CliGitAPIImpl.java:179)
          	at hudson.plugins.git.GitAPI.fetch(GitAPI.java:229)
          	at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:610)
          	... 10 more
          

          I have a valid "Username with password" credential selected. On the project configuration page, it presents a red error message:

          Failed to connect to repository : Failed to connect to https://git.domainname.net/scm/SVC/devkit.git using credentials credentialsname

          Jonathan Brecher added a comment - We are also experiencing this problem. I have found no way to get this working, even with assorted values in the credentials plugin. My best guess at the moment is that the plugin is unable to deal with self-signed SSL certificates... but since I don't have a non-self-signed certificate to switch to, I can't confirm. The only solution I've found is reverting all the way back to git 1.2.0 plugin as described at https://issues.jenkins-ci.org/browse/JENKINS-17204 . Versions 1.3.0 through 1.5.0 failed with one error message; Version 2.0 continues to fail, although with a different error message: Started by user My Name [EnvInject] - Loading node environment variables. Building on master in workspace D:\Jenkins\jobs\test\workspace Fetching changes from the remote Git repository Fetching upstream changes from https: //validusername@git.domainname.net/scm/SVC/devkit.git FATAL: Failed to fetch from https: //validusername@git.domainname.net/scm/SVC/devkit.git hudson.plugins.git.GitException: Failed to fetch from https: //validusername@git.domainname.net/scm/SVC/devkit.git at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:612) at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:836) at hudson.plugins.git.GitSCM.checkout(GitSCM.java:861) at hudson.model.AbstractProject.checkout(AbstractProject.java:1412) at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:652) at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:88) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:557) at hudson.model.Run.execute(Run.java:1679) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:230) Caused by: hudson.plugins.git.GitException: Failed to connect to https: //validusername@git.domainname.net/scm/SVC/devkit.git at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.getURLWithCrendentials(CliGitAPIImpl.java:1441) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.fetch(CliGitAPIImpl.java:179) at hudson.plugins.git.GitAPI.fetch(GitAPI.java:229) at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:610) ... 10 more I have a valid "Username with password" credential selected. On the project configuration page, it presents a red error message: Failed to connect to repository : Failed to connect to https: //git.domainname.net/scm/SVC/devkit.git using credentials credentialsname

          Mark Waite added a comment -

          I've read in other bug reports that self signed certificates are a problem.
          I don't recall the details of the problem, only that they were a problem.

          The only work around I've heard is to switch protocol to something other
          than https. Can you use ssh instead of https?

          Mark Waite added a comment - I've read in other bug reports that self signed certificates are a problem. I don't recall the details of the problem, only that they were a problem. The only work around I've heard is to switch protocol to something other than https. Can you use ssh instead of https?

          Michael Tutty added a comment -

          It's not self-signed certs in my case. Something is wrong with either the default credentials added to the GitClient instance, or the format of the command that's actually run. No network request is ever opened from the Jenkins server, it fails immediately.

          Notice line 150 in the Git plugin's job configuration code: https://github.com/jenkinsci/git-plugin/blame/master/src/main/java/hudson/plugins/git/UserRemoteConfig.java - it was changed on 10-09-13.

          Also check line 1261 in the Git client implementation: https://github.com/jenkinsci/git-client-plugin/blame/master/src/main/java/org/jenkinsci/plugins/gitclient/CliGitAPIImpl.java - credential-related changes also made about a month ago.

          This would be a great place to add some logging code, I was unable to diagnose anything with the logging facility in Jenkins web UI. Specifically, it would be great when the underlying process returns != 0, to know the exact command-line and args that were used, as well as the contents of STDOUT and STDERR.

          Michael Tutty added a comment - It's not self-signed certs in my case. Something is wrong with either the default credentials added to the GitClient instance, or the format of the command that's actually run. No network request is ever opened from the Jenkins server, it fails immediately. Notice line 150 in the Git plugin's job configuration code: https://github.com/jenkinsci/git-plugin/blame/master/src/main/java/hudson/plugins/git/UserRemoteConfig.java - it was changed on 10-09-13. Also check line 1261 in the Git client implementation: https://github.com/jenkinsci/git-client-plugin/blame/master/src/main/java/org/jenkinsci/plugins/gitclient/CliGitAPIImpl.java - credential-related changes also made about a month ago. This would be a great place to add some logging code, I was unable to diagnose anything with the logging facility in Jenkins web UI. Specifically, it would be great when the underlying process returns != 0, to know the exact command-line and args that were used, as well as the contents of STDOUT and STDERR.

          Switching to ssh for us would require significant user retraining, and updating of hundreds of existing Jenkins jobs. So yes, we can switch to ssh. It wouldn't be our first choice, though. Downgrading to 1.2.0 of the Git plugin isn't our first choice either, but way higher on the list than switching to ssh.

          Jonathan Brecher added a comment - Switching to ssh for us would require significant user retraining, and updating of hundreds of existing Jenkins jobs. So yes, we can switch to ssh. It wouldn't be our first choice, though. Downgrading to 1.2.0 of the Git plugin isn't our first choice either, but way higher on the list than switching to ssh.

          Michael Tutty added a comment -

          I downgraded git-client and git packages in Jenkins, and it's working again.

          Michael Tutty added a comment - I downgraded git-client and git packages in Jenkins, and it's working again.

          In our case, git-client seems NOT to be a problem.
          git-client 1.4.6 with git 1.2.0 works fine
          git-client 1.4.6 with git 2.0 fails

          Jonathan Brecher added a comment - In our case, git-client seems NOT to be a problem. git-client 1.4.6 with git 1.2.0 works fine git-client 1.4.6 with git 2.0 fails

          Juergen Klasen added a comment - - edited

          Today I was able to check that issue again on a non-production environment:
          I upgraded the git-client plugin (again) to version 1.4.6 and git plugin to 2.0
          I checked to have a valid credential configured in the credential plugin
          -> scope 'global', username=xxx, password=yyy (where 'xxx' and 'yyy' are valid for my git server - like said
          A correct selfsigned certificate is there (else it wouldn't work with the older plugins 1.0.7 resp. 1.5.0 )
          I configured my job to use a connection URL to the git server like
          https://<myserver>/<myrepository>
          and selected the credentials for user 'xxx'

          Result is, that I receive a

          "Failed to connect to repository : Failed to connect to https://<myserver>/<myrepository> using credentials connection to GIT repo on <myserver>" error.

          So, either there's a bug with the git-related plugins, or the credentials plugin ?

          What else to do, in order to provide more debugging information?

          Juergen Klasen added a comment - - edited Today I was able to check that issue again on a non-production environment: I upgraded the git-client plugin (again) to version 1.4.6 and git plugin to 2.0 I checked to have a valid credential configured in the credential plugin -> scope 'global', username=xxx, password=yyy (where 'xxx' and 'yyy' are valid for my git server - like said A correct selfsigned certificate is there (else it wouldn't work with the older plugins 1.0.7 resp. 1.5.0 ) I configured my job to use a connection URL to the git server like https://<myserver>/<myrepository> and selected the credentials for user 'xxx' Result is, that I receive a "Failed to connect to repository : Failed to connect to https://<myserver>/<myrepository> using credentials connection to GIT repo on <myserver>" error. So, either there's a bug with the git-related plugins, or the credentials plugin ? What else to do, in order to provide more debugging information?

            ndeloof Nicolas De Loof
            jklasen Juergen Klasen
            Votes:
            11 Vote for this issue
            Watchers:
            19 Start watching this issue

              Created:
              Updated:
              Resolved: