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

Having issues after setting up ssh Connection to Github

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • git-client-plugin
    • None
    • Git client plugin
      Version6.1.1

      Jenkins 2.479.3

      I setup Jenkins to use ssh with Github.

       

      Add public key to deploy key on GitHub
      Add private key to jenkins project.  Record id for Jenkinsfile
      Get host id: ssh-keyscan github-stg.corp.zynga.com
      Copy the key for ecdsa-sha2-nistp256. 
      Add to Jenkins manage -> security -> Git Host Key Verification Configuration -> Manually provided keys
      

      I was able to successfully build.  I am using pipeline builds. 
      I then switched it back to https and I get a connection error.  The console shows that the connection is fine. 

      But the build gives an error:
      20:00:42 Started by user
      Matt Peterson
      20:00:42 Running as
      Matt Peterson
      20:02:53 hudson.plugins.git.GitException: Command "git fetch --tags --force --progress --prune – origin +refs/heads/main:refs/remotes/origin/main" returned status code 128:20:02:53 stdout: 20:02:53 stderr: fatal: unable to access '
      https://github-stg.corp.zynga.com/mapeterson/deploykey_test.git/
      ': Failed to connect to github-stg.corp.zynga.com port 443 after 131052 ms: Couldn't connect to server*20:02:53* 20:02:53 at PluginClassLoader for git-client//org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2848)20:02:53 at PluginClassLoader for git-client//org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:2184)20:02:53 at PluginClassLoader for git-client//org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:635)20:02:53 at PluginClassLoader for git//jenkins.plugins.git.GitSCMFileSystem$BuilderImpl.build(GitSCMFileSystem.java:408)20:02:53 Caused: java.io.IOException*20:02:53* at PluginClassLoader for git//jenkins.plugins.git.GitSCMFileSystem$BuilderImpl.build(GitSCMFileSystem.java:413)20:02:53 at PluginClassLoader for scm-api//jenkins.scm.api.SCMFileSystem.of(SCMFileSystem.java:219)20:02:53 at PluginClassLoader for workflow-cps//org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:126)20:02:53 at PluginClassLoader for workflow-cps//org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:73)20:02:53 at PluginClassLoader for workflow-job//org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:311)20:02:53 at hudson.model.ResourceController.execute(ResourceController.java:101)20:02:53 at hudson.model.Executor.run(Executor.java:445)20:02:53 [Checks API] No suitable checks publisher found.20:02:54 Finished: FAILURE
       

          [JENKINS-75234] Having issues after setting up ssh Connection to Github

          Mark Waite added a comment - - edited

          The message in the stack trace seems to indicate that the server github-stg.corp.zynga.com is not responding to the HTTP request after 131 seconds. That might indicate that the credential is invalid. For example, if you're using a git statement or a checkout scm statement that includes a credential, then you need to assure that credential is the personal access token and not an ssh private key credential.

          I suspect this is a configuration error rather than a bug in the git client plugin, since I was unable to duplicate it in my test. The test that I performed was with Jenkins 2.492.1-rc and latest plugins as documented in my plugin list. The first Pipeline script was:

          pipeline {
              agent any
              stages {
                  stage('checkout') {
                      steps {
                          git credentialsId: 'MarkEWaite-github-rsa-private-key', url: 'git@github.com:MarkEWaite/bin.git'
                      }
                  }
              }
          }
          

          That worked as expected. Then I changed the Pipeline script to be:

          pipeline {
              agent any
              stages {
                  stage('checkout') {
                      steps {
                          git credentialsId: 'MarkEWaite-github-token-2019-05-25', url: 'https://github.com/MarkEWaite/bin.git'
                      }
                  }
              }
          }
          

          That worked as expected.

          More details will be needed so that others can duplicate the issue as reported.

          Mark Waite added a comment - - edited The message in the stack trace seems to indicate that the server github-stg.corp.zynga.com is not responding to the HTTP request after 131 seconds. That might indicate that the credential is invalid. For example, if you're using a git statement or a checkout scm statement that includes a credential, then you need to assure that credential is the personal access token and not an ssh private key credential. I suspect this is a configuration error rather than a bug in the git client plugin, since I was unable to duplicate it in my test. The test that I performed was with Jenkins 2.492.1-rc and latest plugins as documented in my plugin list . The first Pipeline script was: pipeline { agent any stages { stage( 'checkout' ) { steps { git credentialsId: 'MarkEWaite-github-rsa- private -key' , url: 'git@github.com:MarkEWaite/bin.git' } } } } That worked as expected. Then I changed the Pipeline script to be: pipeline { agent any stages { stage( 'checkout' ) { steps { git credentialsId: 'MarkEWaite-github-token-2019-05-25' , url: 'https: //github.com/MarkEWaite/bin.git' } } } } That worked as expected. More details will be needed so that others can duplicate the issue as reported.

            Unassigned Unassigned
            mapeterson Matt
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: