Topic on Talk:Gerrit/Advanced usage

git review broken when cloning using review

4
Mattflaschen (talkcontribs)

When I cloned using the review shortcut recommended here:

git clone -o gerrit ssh://review/mediawiki/extensions/Onboarding.git

the .git/config looked like:

[remote "gerrit"]
    fetch = +refs/heads/*:refs/remotes/gerrit/*
    url = ssh://review/mediawiki/extensions/Onboarding.git

which makes sense. However, git review failed with:

Problems encountered installing commit-msg hook
The following command failed with exit code 1
    "scp -P 22 review:hooks/commit-msg .git/hooks/commit-msg"
-----------------------
Permission denied (publickey).
-----------------------

until I changed it to:

url = ssh://mattflaschen@gerrit.wikimedia.org:29418/mediawiki/extensions/EventLogging.git

ssh review prints the standard "Welcome to Gerrit Code Review...Unfortunately, interactive shells are disabled." so I think the .ssh/config is correct. It's:

Host review
     Hostname gerrit.wikimedia.org
     Port 29418
     User mattflaschen

Am I missing something, or are these instructions wrong? Does anyone know the specific cause?

This post was posted by Mattflaschen, but signed as Superm401.

Mattflaschen (talkcontribs)

As you can see when I spelled it out, I switched the repo. I'm in the process of retesting properly.

This post was posted by Mattflaschen, but signed as Superm401.

Mattflaschen (talkcontribs)

Saper confirmed this issue. I was still able to do the setup with the correct spelled out repo, so it's not a repo-specific issue.

This post was posted by Mattflaschen, but signed as Superm401.

Saper (talkcontribs)

It's git-review bug 912125. It does not understand SSH shortcuts and insists on "username@full.host.name:port" syntax.

Personally I prefer having an SSH shortcut and use

git fetch gerrit refs/changes/BB/AAAABB/PP 

to fetch a patchset (git-review -d)

and

git push gerrit HEAD:refs/for/master

or

git push gerrit HEAD:refs/changes/AAAABB

to push changes to gerrit (equivalent of git-review without parameters).

You can ofc have two remotes: I sometimes use "review" with SSH shortcut for the above commands and "gerrit" for git-review. YMMV.

Reply to "git review broken when cloning using review"