Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-32834

Failed to connect to repository with password-protected ssh key

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Blocker
    • Resolution: Fixed
    • Component/s: git-client-plugin
    • Environment:
    • Similar Issues:

      Description

      Cannot connect to repository after upgrading to git-client-plugin 1.19.3. Downgrading to 1.19.2 fixes the issue. The key used to connect to the repository is password-protected.

      Logging-in into Jenkins and executing following command succeeds:

      ssh-agent bash -c 'ssh-add ~/.ssh/jenkins.opencms-core.id_rsa; git -c core.askpass=true ls-remote ssh://git@mygithubenterprise:myrepo/tests.git'

      GUI Error message:

      Failed to connect to repository : Command "git -c core.askpass=true ls-remote -h git@mygithubenterprise:myrepo/tests.git HEAD" returned status code 128:
      stdout: 
      stderr: Permission denied (publickey). 
      fatal: Could not read from remote repository.
      
      Please make sure you have the correct access rights
      and the repository exists.
      
      

      Console output if forcing build:

      Started by user myuser
      Building in workspace /srv/jenkins/jobs/Tests/jobs/kk/workspace
      Wiping out workspace first.
      Cloning the remote Git repository
      Cloning repository git@mygithubenterprise:myrepo/tests.git
       > git init /srv/jenkins/jobs/Tests/jobs/kk/workspace # timeout=10
      Fetching upstream changes from git@mygithubenterprise:myrepo/tests.git
       > git --version # timeout=10
      using GIT_SSH to set credentials jenkins.tests.id_rsa pass
       > git -c core.askpass=true fetch --tags --progress git@mygithubenterprise:myrepo/tests.git +refs/heads/*:refs/remotes/origin/*
      ERROR: Error cloning remote repo 'origin'
      hudson.plugins.git.GitException: Command "git -c core.askpass=true fetch --tags --progress git@mygithubenterprise:myrepo/tests.git +refs/heads/*:refs/remotes/origin/*" returned status code 128:
      stdout: 
      stderr: Permission denied (publickey).
      fatal: Could not read from remote repository.
      
      Please make sure you have the correct access rights
      and the repository exists.
      
      	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1710)
      	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1454)
      	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:63)
      	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:314)
      	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:506)
      	at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1013)
      	at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1053)
      	at hudson.scm.SCM.checkout(SCM.java:485)
      	at hudson.model.AbstractProject.checkout(AbstractProject.java:1269)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:607)
      	at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:529)
      	at hudson.model.Run.execute(Run.java:1738)
      	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
      	at hudson.model.ResourceController.execute(ResourceController.java:98)
      	at hudson.model.Executor.run(Executor.java:410)
      

        Attachments

          Activity

          agallardo Alberto Gallardo created issue -
          agallardo Alberto Gallardo made changes -
          Field Original Value New Value
          Environment plugins:
          Name Version Enabled Pinned
          credentials: 1.24 true true
          ghprb: 1.30.1 true false
          git: 2.4.2 true false
          git-client: 1.19.3 true false
          github: 1.17.0 true false
          github-api: 1.72 true false

          System Properties:
          os.arch: amd64
          os.name: Linux
          os.version: 3.0.101-68-default
          java.runtime.name: Java(TM) SE Runtime Environment
          java.runtime.version: 1.7.0_79-b15
          java.vendor: Oracle Corporation
          plugins:
          git-client: 1.19.3; credentials: 1.24; ghprb: 1.30.1; git: 2.4.2; github: 1.17.0; github-api: 1.72

          System Properties:
          os.arch: amd64
          os.name: Linux
          os.version: 3.0.101-68-default
          java.runtime.name: Java(TM) SE Runtime Environment
          java.runtime.version: 1.7.0_79-b15
          java.vendor: Oracle Corporation
          agallardo Alberto Gallardo made changes -
          Description Cannot connect to repository after upgrading to git-client-plugin 1.19.3. Downgrading to 1.19.2 fixes the issue. The key used to connect to the repository is password-protected.

          Logging-in into Jenkins and executing following command succeeds:

          {{ssh-agent bash -c 'ssh-add ~/.ssh/jenkins.opencms-core.id_rsa; git -c core.askpass=true ls-remote ssh://git@mygithubenterprise:myrepo/tests.git'}}


          GUI Error message:
          {{Failed to connect to repository : Command "git -c core.askpass=true ls-remote -h git@mygithubenterprise:myrepo/tests.git HEAD" returned status code 128:
          stdout:
          stderr: Permission denied (publickey).
          fatal: Could not read from remote repository.

          Please make sure you have the correct access rights
          and the repository exists.}}

          Console output if forcing build:
          {{Started by user myuser
          Building in workspace /srv/jenkins/jobs/Tests/jobs/kk/workspace
          Wiping out workspace first.
          Cloning the remote Git repository
          Cloning repository git@mygithubenterprise:myrepo/tests.git
           > git init /srv/jenkins/jobs/Tests/jobs/kk/workspace # timeout=10
          Fetching upstream changes from git@mygithubenterprise:myrepo/tests.git
           > git --version # timeout=10
          using GIT_SSH to set credentials jenkins.tests.id_rsa pass
           > git -c core.askpass=true fetch --tags --progress git@mygithubenterprise:myrepo/tests.git +refs/heads/*:refs/remotes/origin/*
          ERROR: Error cloning remote repo 'origin'
          hudson.plugins.git.GitException: Command "git -c core.askpass=true fetch --tags --progress git@mygithubenterprise:myrepo/tests.git +refs/heads/*:refs/remotes/origin/*" returned status code 128:
          stdout:
          stderr: Permission denied (publickey).
          fatal: Could not read from remote repository.

          Please make sure you have the correct access rights
          and the repository exists.

          at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1710)
          at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1454)
          at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:63)
          at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:314)
          at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:506)
          at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1013)
          at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1053)
          at hudson.scm.SCM.checkout(SCM.java:485)
          at hudson.model.AbstractProject.checkout(AbstractProject.java:1269)
          at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:607)
          at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
          at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:529)
          at hudson.model.Run.execute(Run.java:1738)
          at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
          at hudson.model.ResourceController.execute(ResourceController.java:98)
          at hudson.model.Executor.run(Executor.java:410)}}
          Cannot connect to repository after upgrading to git-client-plugin 1.19.3. Downgrading to 1.19.2 fixes the issue. The key used to connect to the repository is password-protected.

          Logging-in into Jenkins and executing following command succeeds:

          {{ssh-agent bash -c 'ssh-add ~/.ssh/jenkins.opencms-core.id_rsa; git -c core.askpass=true ls-remote ssh://git@mygithubenterprise:myrepo/tests.git'}}


          GUI Error message:

          {{Failed to connect to repository : Command "git -c core.askpass=true ls-remote -h git@mygithubenterprise:myrepo/tests.git HEAD" returned status code 128:
          stdout:
          stderr: Permission denied (publickey).
          fatal: Could not read from remote repository.

          Please make sure you have the correct access rights
          and the repository exists.}}

          Console output if forcing build:

          {{Started by user myuser
          Building in workspace /srv/jenkins/jobs/Tests/jobs/kk/workspace
          Wiping out workspace first.
          Cloning the remote Git repository
          Cloning repository git@mygithubenterprise:myrepo/tests.git
           > git init /srv/jenkins/jobs/Tests/jobs/kk/workspace # timeout=10
          Fetching upstream changes from git@mygithubenterprise:myrepo/tests.git
           > git --version # timeout=10
          using GIT_SSH to set credentials jenkins.tests.id_rsa pass
           > git -c core.askpass=true fetch --tags --progress git@mygithubenterprise:myrepo/tests.git +refs/heads/*:refs/remotes/origin/*
          ERROR: Error cloning remote repo 'origin'
          hudson.plugins.git.GitException: Command "git -c core.askpass=true fetch --tags --progress git@mygithubenterprise:myrepo/tests.git +refs/heads/*:refs/remotes/origin/*" returned status code 128:
          stdout:
          stderr: Permission denied (publickey).
          fatal: Could not read from remote repository.

          Please make sure you have the correct access rights
          and the repository exists.

          at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1710)
          at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1454)
          at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:63)
          at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:314)
          at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:506)
          at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1013)
          at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1053)
          at hudson.scm.SCM.checkout(SCM.java:485)
          at hudson.model.AbstractProject.checkout(AbstractProject.java:1269)
          at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:607)
          at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
          at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:529)
          at hudson.model.Run.execute(Run.java:1738)
          at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
          at hudson.model.ResourceController.execute(ResourceController.java:98)
          at hudson.model.Executor.run(Executor.java:410)}}
          agallardo Alberto Gallardo made changes -
          Description Cannot connect to repository after upgrading to git-client-plugin 1.19.3. Downgrading to 1.19.2 fixes the issue. The key used to connect to the repository is password-protected.

          Logging-in into Jenkins and executing following command succeeds:

          {{ssh-agent bash -c 'ssh-add ~/.ssh/jenkins.opencms-core.id_rsa; git -c core.askpass=true ls-remote ssh://git@mygithubenterprise:myrepo/tests.git'}}


          GUI Error message:

          {{Failed to connect to repository : Command "git -c core.askpass=true ls-remote -h git@mygithubenterprise:myrepo/tests.git HEAD" returned status code 128:
          stdout:
          stderr: Permission denied (publickey).
          fatal: Could not read from remote repository.

          Please make sure you have the correct access rights
          and the repository exists.}}

          Console output if forcing build:

          {{Started by user myuser
          Building in workspace /srv/jenkins/jobs/Tests/jobs/kk/workspace
          Wiping out workspace first.
          Cloning the remote Git repository
          Cloning repository git@mygithubenterprise:myrepo/tests.git
           > git init /srv/jenkins/jobs/Tests/jobs/kk/workspace # timeout=10
          Fetching upstream changes from git@mygithubenterprise:myrepo/tests.git
           > git --version # timeout=10
          using GIT_SSH to set credentials jenkins.tests.id_rsa pass
           > git -c core.askpass=true fetch --tags --progress git@mygithubenterprise:myrepo/tests.git +refs/heads/*:refs/remotes/origin/*
          ERROR: Error cloning remote repo 'origin'
          hudson.plugins.git.GitException: Command "git -c core.askpass=true fetch --tags --progress git@mygithubenterprise:myrepo/tests.git +refs/heads/*:refs/remotes/origin/*" returned status code 128:
          stdout:
          stderr: Permission denied (publickey).
          fatal: Could not read from remote repository.

          Please make sure you have the correct access rights
          and the repository exists.

          at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1710)
          at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1454)
          at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:63)
          at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:314)
          at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:506)
          at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1013)
          at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1053)
          at hudson.scm.SCM.checkout(SCM.java:485)
          at hudson.model.AbstractProject.checkout(AbstractProject.java:1269)
          at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:607)
          at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
          at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:529)
          at hudson.model.Run.execute(Run.java:1738)
          at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
          at hudson.model.ResourceController.execute(ResourceController.java:98)
          at hudson.model.Executor.run(Executor.java:410)}}
          Cannot connect to repository after upgrading to git-client-plugin 1.19.3. Downgrading to 1.19.2 fixes the issue. The key used to connect to the repository is password-protected.

          Logging-in into Jenkins and executing following command succeeds:

          {{ssh-agent bash -c 'ssh-add ~/.ssh/jenkins.opencms-core.id_rsa; git -c core.askpass=true ls-remote ssh://git@mygithubenterprise:myrepo/tests.git'}}


          GUI Error message:


          {noformat}
          Failed to connect to repository : Command "git -c core.askpass=true ls-remote -h git@mygithubenterprise:myrepo/tests.git HEAD" returned status code 128:
          stdout:
          stderr: Permission denied (publickey).
          fatal: Could not read from remote repository.

          Please make sure you have the correct access rights
          and the repository exists.

          {noformat}


          Console output if forcing build:


          {noformat}
          Started by user myuser
          Building in workspace /srv/jenkins/jobs/Tests/jobs/kk/workspace
          Wiping out workspace first.
          Cloning the remote Git repository
          Cloning repository git@mygithubenterprise:myrepo/tests.git
           > git init /srv/jenkins/jobs/Tests/jobs/kk/workspace # timeout=10
          Fetching upstream changes from git@mygithubenterprise:myrepo/tests.git
           > git --version # timeout=10
          using GIT_SSH to set credentials jenkins.tests.id_rsa pass
           > git -c core.askpass=true fetch --tags --progress git@mygithubenterprise:myrepo/tests.git +refs/heads/*:refs/remotes/origin/*
          ERROR: Error cloning remote repo 'origin'
          hudson.plugins.git.GitException: Command "git -c core.askpass=true fetch --tags --progress git@mygithubenterprise:myrepo/tests.git +refs/heads/*:refs/remotes/origin/*" returned status code 128:
          stdout:
          stderr: Permission denied (publickey).
          fatal: Could not read from remote repository.

          Please make sure you have the correct access rights
          and the repository exists.

          at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1710)
          at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1454)
          at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:63)
          at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:314)
          at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:506)
          at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1013)
          at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1053)
          at hudson.scm.SCM.checkout(SCM.java:485)
          at hudson.model.AbstractProject.checkout(AbstractProject.java:1269)
          at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:607)
          at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
          at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:529)
          at hudson.model.Run.execute(Run.java:1738)
          at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
          at hudson.model.ResourceController.execute(ResourceController.java:98)
          at hudson.model.Executor.run(Executor.java:410)
          {noformat}
          markewaite Mark Waite made changes -
          Assignee Nicolas De Loof [ ndeloof ] Mark Waite [ markewaite ]
          agallardo Alberto Gallardo made changes -
          Attachment config.xml [ 31814 ]
          markewaite Mark Waite made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          agallardo Alberto Gallardo made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          rtyler R. Tyler Croy made changes -
          Workflow JNJira [ 168526 ] JNJira + In-Review [ 209690 ]

            People

            • Assignee:
              markewaite Mark Waite
              Reporter:
              agallardo Alberto Gallardo
            • Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: