How to use SSH keys with Jenkins Workflow Plugin

Have a groovy script that’s executed by the Jenkins Worflow Plugin.

As documented, the git step has only basic configuration so far, having only a single url parameter, and it’s suggested to use the general checkout scm step for anything more complex.

  • Jenkins git plugin - soooo slow sometimes
  • Why does git diff on Windows warn that the “terminal is not fully functional”?
  • How to create a new gitlab repo from my existing local git repo, using CLI?
  • git commit error message: cannot open (a previously deleted source file)
  • Git: Pulling from Remote by Tag
  • git svn clone large repo under Windows: out of memory - not a large file issue
  • With this, it’s possible to pass credentialsId as so:

    checkout scm: [$class: 'MercurialSCM', source: 'ssh://hg@bitbucket.org/user/repo', clean: true, credentialsId: '1234-5678-abcd']
    

    But how would one get this to work with an SSH key credentials instead?

  • How to create a Git pull request from within Eclipse
  • How can I make git accept a self signed certificate?
  • Fix git branch after another developer did a reset
  • GIT How to clean history pack for old deleted files?
  • Anyone familiar with the git error “missing object 0000000000000000000000000000000000000000 for refs/heads/…”?
  • git push NOT current branch to remote
  • One Solution collect form web for “How to use SSH keys with Jenkins Workflow Plugin”

    The same syntax should work for SSH private key credentials.

    By the way as of 1.4 you can pass credentialsId to the simple git step.

    Also if you update the SSH Credentials plugin you can also choose a human-readable ID (when creating a new credentials item).

    Git Baby is a git and github fan, let's start git clone.