I'm still having this issue on Jenkins 2.58 with the SSH Agent plugin version 1.15.
Steps to reproduce:
- Add a Job with Git source code management
- Choose a deploy key for the Repository
- Save the job and build it
- Verify that the job clones the Repository correctly (SUCCESS)
- Configure the Job again
- Enable SSH Agent
- Add two keys in SSH Agent config—and set the deploy key used for Git as the second key
- Run the job again
- Now the job fails when attempting to connect to the SCM repo.
I've also verified that if I set the SCM repo key as the first one used by the SSH Agent plugin, that git clone works.
So I guess the bug is actually: Only the first key added to the SSH Agent seems to work in the Job build process.