I am in the process of trying to migrate Gerrit and Jenkins to a new datacenter. I have successfully installed the applications on their new hardware, but am having difficulty getting Jenkins to read from a Gerrit repository on the same server.
As the Jenkins user already existed on the server, I updated its ssh keys using one I generated from my account on my laptop (pablo@mena-xps), using the following command:
cat ~/.ssh/id_rsa.pub | ssh -p 29418 pmena@gerrit_host gerrit set-account --add-ssh-key - jenkins
I
confirmed that I am able to use this key to interrogate gerrit from my laptop:
pablo@mena-xps=> ssh -p 29418 pmena@gerrit_host gerrit version
gerrit version 2.10
On the Jenkins server, I added the Private key under "Credentials" and
then Configured the specific job to use that key to access a specific
gerrit repo. That returns the following error in the GUI:
Failed to connect to repository : Command "git -c core.askpass=true ls-remote -h ssh://gerrit_host:29418/my_repo HEAD" returned status code 128:
stdout:
stderr: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
How can I go about troubleshooting this issue? Is there something I've overlooked in my approach? Thanks in advance.