Page MenuHomePhabricator

Unable to push changes to gerrit when using Vagrant
Open, LowPublic

Description

After making some changes to
/vagrant/mediawiki/extensions/CodeEditor/modules/jquery.codeEditor.js
I tried to run

git review -R

but I got this:

Problems encountered installing commit-msg hook
The following command failed with exit code 1

"scp  gerrit.wikimedia.org:hooks/commit-msg .git/hooks/commit-msg"

.git/hooks/commit-msg: No such file or directory

This happened before, a few weeks ago, when I tried to make changes to mediawiki core.

If I download the code in other directory, completelly unrelated to vagrant, I'm able to follow the steps from
https://www.mediawiki.org/wiki/Gerrit/Tutorial#How_to_submit_a_patch
normally:
https://gerrit.wikimedia.org/r/#/c/119527/

Am I missing something or is this a bug?


Version: unspecified
Severity: normal

Details

Reference
bz62844

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 3:03 AM
bzimport set Reference to bz62844.
bzimport added a subscriber: Unknown Object (MLST).

I'm still unable to use git review -R (after installing vagrant on Linux Mint 17).
This time the error message is a little different:

me@here ~/mw-vagrant/mediawiki/extensions/Gadgets $ git review -R
Traceback (most recent call last):

File "/usr/local/bin/git-review", line 11, in <module>
  sys.exit(main())
File "/usr/local/lib/python2.7/dist-packages/git_review/cmd.py", line 1202, in main
  set_hooks_commit_msg(remote, hook_file)
File "/usr/local/lib/python2.7/dist-packages/git_review/cmd.py", line 264, in set_hooks_commit_msg
  res = run_http_exc(CannotInstallHook, hook_url, stream=True)
File "/usr/local/lib/python2.7/dist-packages/git_review/cmd.py", line 175, in run_http_exc
  raise klazz(255, str(err), ('GET', url), env)

git_review.cmd.CannotInstallHook: Problems encountered installing commit-msg hook
The following command failed with exit code 255

"GET https://gerrit.wikimedia.org/tools/hooks/commit-msg"

Problems encountered installing commit-msg hook
The following command failed with exit code 104

"GET https://gerrit.wikimedia.org/tools/hooks/commit-msg"

<!DOCTYPE HTML PUBLIC "-IETFDTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /tools/hooks/commit-msg was not found on this server.</p>
</body></html>



With no Vagrant, after pip install -U git-review, I'm getting the same error.

Can you check your

git remote -v

If it only lists HTTP remotes ("https://gerrit.wikimedia.org/r/p/mediawiki/core.git"), than the gerrit repo got checked out using HTTP and not SSH as it should be.

One way to fix this is to have a new checkout as described in

https://www.mediawiki.org/wiki/Gerrit/Tutorial#How_to_submit_a_patch

and have

git clone ssh://USERNAME@gerrit.wikimedia.org:29418/mediawiki/core.git

done again

or fix it using this (assuming your HTTP remote is called "origin"):

git remote add gerrit ssh://USERNAME@gerrit.wikimedia.org:29418/mediawiki/core.git
git remote update
(it it fails at this point, check your SSH key setup, including your SSH agent)

and then

git remote rm origin

now

git-review -s

should "just work"

If you have any commit outstanding, you need probably to "git commit --amend" again to make sure your Change-Id gets generated and included in the commit message.

You can check the last commit message with "git show HEAD".

(In reply to Marcin Cieślak from comment #3)

Can you check your

git remote -v

If it only lists HTTP remotes
("https://gerrit.wikimedia.org/r/p/mediawiki/core.git"), than the gerrit
repo got checked out using HTTP and not SSH as it should be.

Yes. This is what I got:
origin https://gerrit.wikimedia.org/r/p/mediawiki/core.git (fetch)
origin https://gerrit.wikimedia.org/r/p/mediawiki/core.git (push)

Is this because of initial MediaWiki checkout as described on

https://www.mediawiki.org/wiki/MediaWiki-Vagrant

$ git clone https://gerrit.wikimedia.org/r/mediawiki/vagrant
$ cd vagrant
$ git submodule update --init --recursive
$ ./setup.sh # or setup.bat on Windows
$ vagrant up

Maybe if the initial checkout would have been done with

$ git clone ssh://<username>@gerrit.wikimedia.org/:29418/mediawiki/core.git

it would work?

(not using vagrant here)

I just left a longish comment on this topic on the talk page https://www.mediawiki.org/wiki/Talk:MediaWiki-Vagrant#Using_ssh_git_origin_URLs

TL;DR is that out of the box the git origin URLs are not configured for ssh access to gerrit.

Bulk unassigning bugs from Ori.

bd808 triaged this task as Low priority.Dec 30 2014, 2:31 AM