我正在尝试了解 git 和 gerrit 几天,但有一些错误我找不到合适的解决方案。这是错误消息;
*asfaa@asadaf:~/test$ git review -R
Could not connect to gerrit.
Enter your gerrit username: remote0
Trying again with ssh://<username>@<ip>:29418/test
Creating a git remote called "gerrit" that maps to:
ssh://<username>@<ip>:29418/test
This repository is now set up for use with git-review. You can set the
default username for future repositories with:
git config --global --add gitreview.username "remote0"
Your change was committed before the commit hook was installed.
Amending the commit to add a gerrit change id.
remote: Processing changes: refs: 1, done
To ssh://<username>@<ip>:29418/test
! [remote rejected] HEAD -> refs/publish/master (no common ancestry)
error: failed to push some refs to 'ssh://<username>@<ip>:29418/test'*
在执行以下步骤后出现此错误;
- 我使用命令“ssh -p 29418 user@localhost gerrit create-project project_name”创建了一个 gerrit 文件夹
- 然后,我在我的主目录中创建一个相同的文件夹,并使用“git init”命令将其转换为 git repo。
- 然后,我将要推送的项目的所有内容复制到此文件夹中的 gerrit 存储库,并使用“git add --all”命令将所有更改添加为新更改
- 我创建了一个 .gitreview 文件并将主机和项目属性放入其中。
- 提交我的更改。
- 最后,我使用“git review -R”命令将我的更改发送到 gerrit 存储库进行审查。
在这里,在最后一步,如果我使用这个命令git push ssh://[username]@[ip]:29418/project_name
,它就可以工作。但在这种情况下,使用 gerrit 存储库毫无意义,因为我将它们直接推送到 git 而不进行任何审查。此外,我假设稍后当我将此项目克隆到另一台计算机并将我的更改发送到 gerrit 存储库时,我将不得不处理此错误,所以如果我知道我在上面做错了什么会更好。
提前致谢