gerrit: access gerrit repositories as root user by using public key of another user

StackOverflow https://stackoverflow.com/questions/21875000

  •  13-10-2022
  •  | 
  •  

Question

We are using Active Directory for gerrit authentication and added our ssh-public keys to access git repos. If we use usernames same as AD users in linux boxes we are able to work well. But some of our work requires to use root user in linux boxes so we want to use root user completely to clone git repos and push changes to gerrit.

But when we try to clone git repos from root user we are getting below error message

git clone ssh://gerrit.doamin.com:29418/gitrepo.git
Cloning into 'girepo...
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists

I have copied existing gerit user's ssh-key pair to /root/.ssh but still I am facing same issue.

Is it possible to access git repos in gerrit as root by copying public keys of another gerrit user?

Was it helpful?

Solution

I got an answer from gerrit google groups community. Thanks to "David Ostrovsky"

Adding an ssh alias in /root/.ssh/config and use it in clone command:

 Host gerrit
  HostName <gerrit server>
  User joe
  Port 29418
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top