我正在尝试第一次使用 git 设置 gerrit。我正在按照https://www.mediawiki.org/wiki/Gerrit/Tutorial的说明进行操作。我已经安装了 git,创建了一个 gerrit 用户帐户,并设置了我的 ssh 密钥,现在运行后sudo apt-get install git-review
我git review -s -v
在我的 git 目录中运行并得到以下输出:
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
因此,我尝试使用此链接中的说明手动在挂钩中预先安装 commit-msg:https ://www.mediawiki.org/wiki/Gerrit/Alternatives_to_git-review ,它修复了出现此特定错误。但在那之后运行 `git review -s -v' 实际上似乎并没有做任何事情。这是输出:
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
我以为git review -s
应该设置一个 gerrit 遥控器,但现在当我运行时,git remote -v
我看到的是:
origin file:///home/jd/gitrepos/newrepo (fetch)
origin file:///home/jd/gitrepos/newrepo (push)
格里特没有。
我被困在这里,我认为这可能是我的 .gitreview 文件的问题。我已经研究了一段时间,所以我已经阅读了许多各种各样的说明,现在我在我的存储库中有一个手动创建的 .gitreview 文件,其中包含以下内容:
[gerrit]
host=gerrit.wikimedia.org
project=newrepo.git
关于我的设置的更多背景信息:我的存储库位于 ~/gitrepos/newrepo 中,我正在从该位置拉到 ~/gitworkspace/newrepo。它来自 ~/gitworkspace/newrepo,我在其中运行所有这些命令来尝试设置 gerrit。我最终希望能够从 ~/gitworkspace/newrepo 推送,并在批准将其推送到 ~/gitrepos/newrepo 之前查看有关 gerrit 的评论。