Hello,
I am using 'repo' to manage a multiproject repository of a yocto based project with our own instance of a Gerrit review server.
I encountered the following issue:
dwatkins@kihei:32bit repo_MG-os_test1 $ repo upload
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
----------------------------------------------------------------------
[FAILED] MG-os-base/ master (Upload failed)
[FAILED] meta-MG-os-bsp/ master (Upload failed)
dwatkins@kihei:32bit repo_MG-os_test1 $
After searching for following the usual advice about checking public keys on the gerrit server and verifying that they are all in good order, none of this helped at all.
Then I logged into the gerrit server and output logs/sshd_log, I noticed the following...
[2014-01-23 10:14:10,714 -0800] 9aa62690 darcy.watkins - AUTH FAILURE FROM 192.168.3.163 user-not-found
My workaround was to make sure that my username in my email matched my username on the gerrit server. For my case...
git config --global user.email dwatkins
At my workplace I can internally use 'dwatkins' (unqualified) as email address, but my usual email userid for external email is 'darcy.watkins'. After the above change, 'repo upload' worked properly as expected.
Now I understand why everything worked ok when I evaluated the gerrit workflow on a single Linux box at home, but could never upload to
gerrithub.io and ran into this difficulty when setting things up at work.
I have multiple 'personalities' such as 'darcy', 'dwatkins', 'darcy.watkins' and at some places even 'xstreamworship' which is my personal domain name (i.e.
xstreamworship.com).
At home 'darcy' is my user ID on server and my personal email user ID is 'darcy' - all OK
At work 'dwatkins' is my user ID on workstation and servers but my email user ID is 'darcy.watkins' - difficulty, but able to workaround it since 'dwatkins' is ok for internal email.
When test driving
gerithub.io, 'xstreamworship' is user ID on server, I have no email with 'xstreamworship' as the user ID - I never got it to work, but I think I could now if I lied to 'git'.
So the point of all this is that if you encounter issues related to identity using repo and gerrit and all else appears to be in order (i.e. your keys, etc), then you may want to check how your identity works out between the server and the client. I found this in the gerrit server's sshd_log, but not everyone has access to such a log file.
Is there a better way? I mean, people have multiple emails and identities that they use. Ideally, there would be a way to specify the user ID to use on the server independent of extracting it out of my email. It would be nice to store it in my global ~/.gitconfig but I could also live with a command line option to 'repo init' to set it on a per multiproject repo basis (although I would guess that a person could have different user IDs per review server that they could be dealing with).
I did find a workaround that works OK with our setup at work, but this may be something for the people looking into new features for 'repo' to look at.
Regards,
Darcy