Reputation: 117
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 do I go about troubleshooting this issue? Thank you in advance.
Upvotes: 0
Views: 700
Reputation: 117
To make a long story short, this issue is resolved. The Jenkins account on Gerrit was removed and recreated, after which I was able to successfully push the ssh key pair.
Upvotes: 0