我安装并配置了自己的Gerrit服务器。我使用web gui为Gerrit创建了一个存储库。我能够使用“git”命令成功克隆这个空的存储库,所以配置似乎没问题。接下来,我:
配置了我的访问权限:git config --global user.email ...
,git config --global user.name ...
,
添加了远程:git add remote origin myUser@myGitHost:29418/project.git
,
创建并提交了文件: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-non-fast-forward/。这个拉动输出:
myUser@myGitHost:~/project$ git pull origin master
From ssh://myGitHost:29418/project
* branch master -> FETCH_HEAD
Already up-to-date.
但是当我按下时,输出仍然是相同的:
无法将引用更新为快进。
答案 0 :(得分:7)
您是否试图绕过Gerrit的代码审查功能?如果没有,请尝试git push origin HEAD:refs/for/master