gitUsernamePassword does not provide "Manually provided" SSH host key

This issue is archived. You can view it, but you can't modify it. Learn more

XMLWordPrintable

      I wonder how gitUsernamePassword is supposed to work with the "Manually provided keys" verification strategy. I have a pipeline stage similar to:

      steps {
          unstash 'some-artifact'
      
          sh """
          git checkout --detach
          git add -f .
          git commit -m 'Commit Artifact'
          git tag -f '$tagName'
          """
          withCredentials([gitUsernamePassword(credentialsId: '*********', gitToolName: 'default')]) {
              sh "git push -f origin 'refs/tags/$tagName:refs/tags/$tagName'"
          }
      }
      

      The Host Key Verification Strategy is set to Manually provided keys, and the stage fails with:

      + git push -f origin refs/tags/artifact-v1.2.3:refs/tags/artifact-v1.2.3
      Host key verification failed.
      fatal: Could not read from remote repository.
      
      Please make sure you have the correct access rights and the repository exists.
      

      The pipeline uses the default checkout from the same repo, which succeeds.

            Assignee:
            Mark Waite
            Reporter:
            Yoerg
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Resolved:
              Archived: