I have a little problem with Jenkins and private Github repositories. To check out a private repo, usually one of two things is required:
- private SSH user key in this repo
- registered SSH private key for this repo
The deployment key was executed for this interaction. The problem is that deployment keys must be unique for different projects, so I will have to use different keys every time. This means that I have to add another key to the ssh agent for the Jenkins user for each additional repo.
It also means that, by default, the agent will try to use all available keys and will probably get a connection after several failed attempts with the wrong key.
The Jenkins git plugin does not seem to allow you to point it to an SSH key. Jenkins does not allow command line interaction until validation, so I cannot use bash tricks to set the correct key.
So far, the only solution has been:
- Create user my_jenkins_account on github
- Add public key for user
- Add an account to the repos that I want to verify using Jenkins
- Add user private key to jenkins user
Any alternative suggestions?
source
share