Search code examples
gerritrepo

Wrong username while uploading to review server


I am trying to push my patches to a Gerrit server, I've generated a SSH key and added to the Settings. However, when I'm trying to push(repo upload), it shows another username so I don't have permission to push.

I've tried using git config to set my username but not working at all.

Performed ssh -vv -p 29418 genesis331@gerrit.aospa.co it works but not ssh -vv -p 29418 cheah3838@gerrit.aospa.co.

Btw my email is cheah3838@gmail.com maybe it is an important information?

In the console,

cheah3838@gerrit.aospa.co: Permission denied (publickey).
fatal: Could not read from remote repository.

But actually should be genesis331@gerrit.aospa.co.


Solution

  • You need to configure your Git config for repo upload

    $ git config --global review.gerrit.aospa.co.username genesis331
    

    The repo documentation may help you if you need more information:

    $ repo help upload
    [...]
    review.URL.username:
    
    Override the username used to connect to Gerrit Code Review. By default
    the local part of the email address is used.
    
    The URL must match the review URL listed in the manifest XML file, or in
    the .git/config within the project. For example:
    
      [remote "origin"]
        url = git://git.example.com/project.git
        review = http://review.example.com/
    
      [review "http://review.example.com/"]
        autoupload = true
        autocopy = johndoe@company.com,my-team-alias@company.com
    [...]