Unable to configure ssh keys to read a Gerrit repo from Jenkins

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Unable to configure ssh keys to read a Gerrit repo from Jenkins

PAUL MENA

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.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/b437248a-5200-412f-b6cf-945609823f60n%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Unable to configure ssh keys to read a Gerrit repo from Jenkins

PAUL MENA
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.

On Thursday, October 15, 2020 at 2:25:46 PM UTC-4 PAUL MENA wrote:

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.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/679b6d5c-a753-4926-8fd0-cab6d9ab6a24n%40googlegroups.com.