2

I am in the process of trying to set up gerrit with git for the first time. I am following the instructions from https://www.mediawiki.org/wiki/Gerrit/Tutorial. I have installed git, created a gerrit user account, and set up my ssh keys, and now after running sudo apt-get install git-review I run git review -s -v in my git directory and get the following output:

2018-06-28 08:54:15.098084 Running: git config --get gitreview.remote
2018-06-28 08:54:15.102217 result: origin
2018-06-28 08:54:15.102337 Running: git config --get gitreview.scheme
2018-06-28 08:54:15.106441 using default: None
2018-06-28 08:54:15.106556 Running: git config --get gitreview.hostname
2018-06-28 08:54:15.111010 using default: None
2018-06-28 08:54:15.111106 Running: git config --get gitreview.port
2018-06-28 08:54:15.116715 using default: None
2018-06-28 08:54:15.116873 Running: git config --get gitreview.project
2018-06-28 08:54:15.121874 using default: None
2018-06-28 08:54:15.122029 Running: git log --color=never --oneline HEAD^1..HEAD
2018-06-28 08:54:15.127908 Running: git remote
2018-06-28 08:54:15.134383 Running: git branch -a --color=never
2018-06-28 08:54:15.141301 Running: git rev-parse --show-toplevel --git-dir
2018-06-28 08:54:15.147041 Running: git config --get remote.origin.pushurl
2018-06-28 08:54:15.152315 using default: None
2018-06-28 08:54:15.152473 Running: git config --get remote.origin.url
2018-06-28 08:54:15.157253 result: file:///home/jd/gitrepos/newrepo
2018-06-28 08:54:15.157356 Running: git config --list
Found origin Push URL: file:///home/jd/gitrepos/newrepo
Fetching commit hook from: scp:///hooks/commit-msg
2018-06-28 08:54:15.163017 Running: scp :hooks/commit-msg .git/hooks/commit-msg
Problems encountered installing commit-msg hook
The following command failed with exit code 1
    "scp :hooks/commit-msg .git/hooks/commit-msg"
-----------------------
cp: cannot stat ':hooks/commit-msg': No such file or directory

So I then tried manually pre installing commit-msg in hooks with the instructions from this link: https://www.mediawiki.org/wiki/Gerrit/Alternatives_to_git-review , which fixed getting this specific error. But running `git review -s -v' did not actually seem to do anything after that. Here is the output:

2018-06-28 09:07:13.356813 Running: git config --get gitreview.remote
2018-06-28 09:07:13.360779 result: origin
2018-06-28 09:07:13.360892 Running: git config --get gitreview.scheme
2018-06-28 09:07:13.364968 using default: None
2018-06-28 09:07:13.365102 Running: git config --get gitreview.hostname
2018-06-28 09:07:13.369144 using default: None
2018-06-28 09:07:13.369363 Running: git config --get gitreview.port
2018-06-28 09:07:13.375098 using default: None
2018-06-28 09:07:13.375383 Running: git config --get gitreview.project
2018-06-28 09:07:13.380644 using default: None
2018-06-28 09:07:13.380934 Running: git log --color=never --oneline HEAD^1..HEAD
2018-06-28 09:07:13.387931 Running: git remote
2018-06-28 09:07:13.396294 Running: git branch -a --color=never
2018-06-28 09:07:13.403513 Running: git rev-parse --show-toplevel --git-dir

I thought git review -s was supposed to set up a gerrit remote, but now when I run git remote -v all I see is:

origin  file:///home/jd/gitrepos/newrepo (fetch)
origin  file:///home/jd/gitrepos/newrepo (push)

and nothing for gerrit.

I'm pretty stuck here, I think it could be a problem with my .gitreview file. I've been on this for a while so I have read many assorted instructions and right now I have a manually created .gitreview file in my repository with the contents:

[gerrit]
host=gerrit.wikimedia.org
project=newrepo.git

Some more background on my setup: my repository is located in ~/gitrepos/newrepo and I am pulling from that location to ~/gitworkspace/newrepo. It is from ~/gitworkspace/newrepo where I am running all these commands to try and set up gerrit. I would eventually like to be able to push from ~/gitworkspace/newrepo , and see the review on gerrit before approving it to be able to be pushed to ~/gitrepos/newrepo.

readytotaste
  • 199
  • 2
  • 4
  • 17

1 Answers1

0

These lines:

2018-06-28 09:07:13.356813 Running: git config --get gitreview.remote
2018-06-28 09:07:13.360779 result: origin

indicate that the default remote is origin and it looks like that remote was indeed set up. So that seems to be working as expected.

The other problem you are indicating is that git-review was not able to copy the commit-msg hook. This one I am less sure about. It looks like gerrit was not able to find the commit-msg hook. This leads me to think it is one of two causes:

  1. The commit hook is not where it is supposed to be (is your gerrit install not the default one?)
  2. Your remote is not configured properly inside of gerrit and so scp calls to that remote are not working correctly.

my guess is that because your remote is not located

Andrew Eisenberg
  • 28,387
  • 9
  • 92
  • 148