简体   繁体   English

git review -s无法正常工作

[英]git review -s not working properly

I am in the process of trying to set up gerrit with git for the first time. 我正在尝试首次使用git设置gerrit。 I am following the instructions from https://www.mediawiki.org/wiki/Gerrit/Tutorial . 我正在按照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: 我已经安装了git,创建了一个gerrit用户帐户,并设置了我的ssh密钥,现在在运行sudo apt-get install git-review我在git目录中运行git review -s -v并获得以下输出:

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. 因此,然后我尝试使用此链接中的说明,手动在钩子中预安装commit-msg: https : //www.mediawiki.org/wiki/Gerrit/Alternatives_to_git-review ,该错误修复了出现此特定错误的问题。 But running `git review -s -v' did not actually seem to do anything after that. 但是在那之后运行git review -s -v实际上似乎没有任何作用。 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: 我以为git review -s应该设置一个gerrit远程,但是现在当我运行git remote -v我看到的是:

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. 我很困在这里,我认为.gitreview文件可能有问题。 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: 我已经进行了一段时间,所以我阅读了许多各种各样的说明,现在我在存储库中手动创建了一个.gitreview文件,内容如下:

[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. 我的设置还有更多背景知识:我的存储库位于〜/ gitrepos / newrepo中,而我将从该位置拉至〜/ gitworkspace / newrepo。 It is from ~/gitworkspace/newrepo where I am running all these commands to try and set up gerrit. 我是从〜/ gitworkspace / newrepo运行所有这些命令来尝试设置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. 我最终希望能够从〜/ gitworkspace / newrepo推送,并在批准将其推送到〜/ gitrepos / newrepo之前查看有关gerrit的评论。

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. 表示默认远程服务器是origin ,看起来确实已设置了该远程服务器。 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. 您指示的另一个问题是git-review无法复制commit-msg挂钩。 This one I am less sure about. 我不太确定这一点。 It looks like gerrit was not able to find the commit-msg hook. 看来gerrit无法找到commit-msg钩子。 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?) 提交钩不在预期的位置(您的gerrit安装不是默认安装吗?)
  2. Your remote is not configured properly inside of gerrit and so scp calls to that remote are not working correctly. 您的遥控器未在gerrit内部正确配置,因此对该遥控器的scp调用无法正常工作。

my guess is that because your remote is not located 我的猜测是,因为您的遥控器不在

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM