Jenkins ssh-agent cannot find credentials

I am trying to use ssh-agent to push commits to a remote git repository from a Jenkins script.

I installed the plugin and added the SSH private key to the Credentials section of Jenkins. Below is a snippet from a Groovy class created and called from a Jenkins file:

stages.sshagent(credentials:['26954b1f-2e32-4b4b-8923-3b7a9fbac6c9']) {
    stages.sh "git push origin ${branchName}"
}

      

Note: Stages are just a view of a scene in a Jenkins file. The class compiles fine, but the following error message is displayed each time:

FATAL: [ssh-agent] Could not find specified credentials

      

If I use credentials with a git client then it works fine, but unfortunately this does not support push git.

+3


source to share





All Articles