Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gerrit code review push to empty repo doesn't work

I installed and configured my own Gerrit server. I created a repository using the web gui for Gerrit. I am able to clone this empty repository succesfully using the "git" command, so the configuration seems to be fine. Next, I:

  1. configured my access: git config --global user.email ..., git config --global user.name ...,

  2. added remote: git add remote origin myUser@myGitHost:29418/project.git,

  3. created and commited file: git add file, git commit -m "first commit".

So far so good.

But, when I try to push it to my repo, I get output:

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'

I tried to look for solution. The "git pull origin master" does not work. Pushing with -f option isnt working too.

Can anyone help me?

EDIT: The output of 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'

What I mean by The "git pull origin master" is that the most solution ppl mention is to do a pull before push, for example: http://rip747.wordpress.com/2009/04/20/git-push-rejected-non-fast-forward/. This pull outputs:

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

But when I do a push, the output is still the same:

can not update the reference as a fast forward.

like image 563
Rafał Avatar asked Aug 18 '12 17:08

Rafał


1 Answers

Are you trying to bypass the code-review feature of Gerrit? If not, try git push origin HEAD:refs/for/master

like image 143
Brad Avatar answered Oct 26 '22 19:10

Brad