8

我安装并配置了我自己的 Gerrit 服务器。我使用 Gerrit 的 web gui 创建了一个存储库。我可以使用“git”命令成功克隆这个空存储库,所以配置似乎很好。接下来,我:

  1. 配置了我的访问权限:git config --global user.email ..., git config --global user.name ...,

  2. 添加了遥控器:git add remote origin myUser@myGitHost:29418/project.git,

  3. 创建并提交文件:git add file, git commit -m "first commit"

到现在为止还挺好。

但是,当我尝试将其推送到我的仓库时,我得到了输出:

myUser@myGitHost:~/project$ git push origin master
Counting objects: 7, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (6/6), 525 bytes, done.
Total 6 (delta 0), reused 0 (delta 0)
remote: Processing changes: refs: 1, done
To ssh://myUser@myGitHost:29418/project.git
 ! [remote rejected] master -> master (can not update the reference as a fast forward)
error: failed to push some refs to 'ssh://myUser@myGitHost:29418/project.git'

我试图寻找解决方案。" git pull origin master" 不起作用。-f使用选项推送也不起作用。

谁能帮我?

编辑: push -f 的输出:

myUser@myGitHost:~/project$ git push -f origin master
Counting objects: 7, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (6/6), 525 bytes, done.
Total 6 (delta 0), reused 0 (delta 0)
remote: Processing changes: refs: 1, done
To ssh://myUser@myGitHost:29418/project.git
 ! [remote rejected] master -> master (can not update the reference as a fast forward)
error: failed to push some refs to 'ssh://myUser@myGitHost:29418/project.git'

我所说的“git pull origin master”的意思是人们提到的最解决方案是在推送之前进行拉取,例如:http ://rip747.wordpress.com/2009/04/20/git-push-rejected -非快进/。这个拉输出:

myUser@myGitHost:~/project$ git pull origin master
From ssh://myGitHost:29418/project
 * branch            master     -> FETCH_HEAD
Already up-to-date.

但是当我推送时,输出仍然是一样的:

无法将参考更新为快进。

4

1 回答 1

7

您是否试图绕过 Gerrit 的代码审查功能?如果没有,请尝试git push origin HEAD:refs/for/master

于 2012-08-19T16:17:23.420 回答