git push error......"you are not allowed to upload merges"

9,695 views
Skip to first unread message

rajesh boyapati

unread,
Sep 18, 2011, 9:43:53 PM9/18/11
to Repo and Gerrit Discussion
Hi,

I am getting an error while doing "git push".....like..... "you are
not allowed to upload merges".
I used the command: $ git push <remote name> HEAD:refs/heads/<branch
name>
Here is the scenario, how I faced this error:
a) Developer-1 made changes in a git project, but didn't pushed his
changes to the server.
b) In the mean time Developer-2 pushed his changes for the same git
project to the server.
c) Developer-1 want to get the changes made by Developer-2. So
Developer-1 did "git merge"....."git merge <remote-name>/<branch-
name>"
d) With "git merge", Developer-1 got conflicts.
e) Developer-1 resolved the conflicts and did "git commit".....then,
the log has "merge commit" as latest.
f) Again Developer-1 made changes in some file and commited them.
g) Finally, when Developer-1 tries to push(git push <remote-name>
HEAD:refs/heads/<branchname>), he is getting error like......"you are
not allowed to upload merges".
h) The permissions for refs/heads/* are fine...It has Read, Create
Reference, Push, Push Merge Commit, Forge Author Identity and Forge
Commiter Identity.....We are using Gerrit-2.2.1

Can any one give me steps(with commands and example) on how to resolve
this kind of error?.

Thanks,
Rajesh.

Edwin Kempin

unread,
Sep 19, 2011, 5:00:40 AM9/19/11
to rajesh boyapati, Repo and Gerrit Discussion
2011/9/19 rajesh boyapati <boyapat...@gmail.com>:

> Hi,
>
> I am getting an error while doing "git push".....like..... "you are
> not allowed to upload merges".
> I used the command: $ git push <remote name> HEAD:refs/heads/<branch
> name>
> Here is the scenario, how I faced this error:
> a) Developer-1 made changes in a git project, but didn't pushed his
> changes to the server.
> b) In the mean time Developer-2 pushed his changes for the same git
> project to the server.
> c) Developer-1 want to get the changes made by Developer-2. So
> Developer-1 did "git merge"....."git merge <remote-name>/<branch-
> name>"
In this case I would recommend to rather use "git rebase" instead of
"git merge".
With "git rebase" you avoid having the merge commit and I think it
also makes reviewing easier (since the reviewer can see delta to the
latest central state and not to some historic state on which the
feature was originally developed).

> d) With "git merge", Developer-1 got conflicts.
> e) Developer-1 resolved the conflicts and did "git commit".....then,
> the log has "merge commit" as latest.
> f) Again Developer-1 made changes in some file and commited them.
> g) Finally, when Developer-1 tries to push(git push <remote-name>
> HEAD:refs/heads/<branchname>), he is getting error like......"you are
> not allowed to upload merges".
> h) The permissions for refs/heads/* are fine...It has Read, Create
> Reference, Push, Push Merge Commit, Forge Author Identity and Forge
> Commiter Identity.....We are using Gerrit-2.2.1

The access right that should allow you to push merge commits is 'Push
Merge Commit'.
However there is a bug with this in Gerrit 2.2.1 [1]

[1] http://code.google.com/p/gerrit/issues/detail?id=1072

>
> Can any one give me steps(with commands and example) on how to resolve
> this kind of error?.
>
> Thanks,
> Rajesh.
>

> --
> To unsubscribe, email repo-discuss...@googlegroups.com
> More info at http://groups.google.com/group/repo-discuss?hl=en
>

rajesh boyapati

unread,
Sep 19, 2011, 10:34:51 AM9/19/11
to Repo and Gerrit Discussion
Hi,

Thanks Edwin for your advice. From next time I will do "git rebase",
so that, I have linear history.

What if I already did "git merge" and I am getting error like "you are
not allowed to upload merges" while "git push"?.
How can I resolve this?. Can you elaborate with git commands and
example.

Thanks,
Rajesh.

On Sep 19, 4:00 am, Edwin Kempin <edwin.kem...@gmail.com> wrote:
> 2011/9/19 rajesh boyapati <boyapatisraj...@gmail.com>:> Hi,
>
> > I am getting anerrorwhile doing "gitpush".....like..... "you are
> > not allowed to upload merges".
> > I used the command: $gitpush<remote name> HEAD:refs/heads/<branch
> > name>
> > Here is the scenario, how I faced thiserror:
> > a) Developer-1 made changes in agitproject, but didn't pushed his
> > changes to the server.
> > b) In the mean time Developer-2 pushed his changes for the samegit
> > project to the server.
> > c) Developer-1 want to get the changes made by Developer-2. So
> > Developer-1 did "gitmerge"....."gitmerge <remote-name>/<branch-
> > name>"
>
> In this case I would recommend to rather use "gitrebase" instead of
> "gitmerge".
> With "gitrebase" you avoid having the merge commit and I think it
> also makes reviewing easier (since the reviewer can see delta to the
> latest central state and not to some historic state on which the
> feature was originally developed).
>
> > d) With "gitmerge", Developer-1 got conflicts.
> > e) Developer-1 resolved the conflicts and did "gitcommit".....then,
> > the log has "merge commit" as latest.
> > f) Again Developer-1 made changes in some file and commited them.
> > g) Finally, when Developer-1 tries topush(gitpush<remote-name>
> > HEAD:refs/heads/<branchname>), he is gettingerrorlike......"you are
> > not allowed to upload merges".
> > h) The permissions for refs/heads/* are fine...It has Read, Create
> > Reference,Push,PushMerge Commit, Forge Author Identity and Forge
> > Commiter Identity.....We are using Gerrit-2.2.1
>
> The access right that should allow you topushmerge commits is 'Push

Edwin Kempin

unread,
Sep 20, 2011, 2:11:58 AM9/20/11
to rajesh boyapati, Repo and Gerrit Discussion
2011/9/19 rajesh boyapati <boyapat...@gmail.com>:

> Hi,
>
> Thanks Edwin for your advice. From next time I will do "git rebase",
> so that, I have linear history.
>
> What if I already did "git merge" and I am getting error like "you are
> not allowed to upload merges" while "git push"?.
> How can I resolve this?. Can you elaborate with git commands and
> example.
I would simply checkout the state that Developer-1 had before doing
the merge and then rebase the commit.
I'm not sure how exactly the state in your local repository looks now,
but what should work is the following:
1. in the Gerrit WebUI go to the change of Developer-1 and copy and
execute the checkout command from the download section (something like
'git fetch ssh://<user>@<host>:29418/<project> refs/changes/12/456/1
&& git checkout FETCH_HEAD'); afterwards you should have exactly the
state that Developer-1 has pushed
2. make sure your remote tracking branch is up to date: git fetch
3. rebase the commit: git rebase <remote name>/<branch-name>
4. resolve conflicts if needed
5. make sure that the rebased commit contains the Gerrit Change-Id
6. now push the rebased commit back to Gerrit: git push <remote name>
HEAD:refs/heads/<branch-name>

rajesh boyapati

unread,
Sep 20, 2011, 10:11:28 PM9/20/11
to Repo and Gerrit Discussion
Hi,

Thanks for the sugestions.



On Sep 20, 1:11 am, Edwin Kempin <edwin.kem...@gmail.com> wrote:
> 2011/9/19 rajesh boyapati <boyapatisraj...@gmail.com>:> Hi,
>
> > Thanks Edwin for your advice. From next time I will do "gitrebase",
> > so that, I have linear history.
>
> > What if I already did "gitmerge" and I am gettingerrorlike "you are
> >notallowedtouploadmerges" while "gitpush"?.
> > How can I resolve this?. Can you elaborate withgitcommands and
> > example.
>
> I would simply checkout the state that Developer-1 had before doing
> the merge and then rebase the commit.
> I'mnotsure how exactly the state in your local repository looks now,
> but what should work is the following:
> 1. in the Gerrit WebUI go to the change of Developer-1 and copy and
> execute the checkout command from the download section (something like
> 'gitfetch ssh://<user>@<host>:29418/<project> refs/changes/12/456/1
> &&gitcheckout FETCH_HEAD'); afterwards you should have exactly the
> state that Developer-1 has pushed
> 2. make sure your remote tracking branch is up to date:gitfetch
> 3. rebase the commit:gitrebase <remote name>/<branch-name>
> 4. resolve conflicts if needed
> 5. make sure that the rebased commit contains the Gerrit Change-Id
> 6. nowpushthe rebased commit back to Gerrit:gitpush<remote name>
> HEAD:refs/heads/<branch-name>
>
>
>
> > Thanks,
> > Rajesh.
>
> > On Sep 19, 4:00 am, Edwin Kempin <edwin.kem...@gmail.com> wrote:
> >> 2011/9/19 rajesh boyapati <boyapatisraj...@gmail.com>:> Hi,
>
> >> > I am getting anerrorwhile doing "gitpush".....like..... "you are
> >> >notallowedtouploadmerges".
> >> > I used the command: $gitpush<remote name> HEAD:refs/heads/<branch
> >> > name>
> >> > Here is the scenario, how I faced thiserror:
> >> > a) Developer-1 made changes in agitproject, but didn't pushed his
> >> > changes to the server.
> >> > b) In the mean time Developer-2 pushed his changes for the samegit
> >> > project to the server.
> >> > c) Developer-1 want to get the changes made by Developer-2. So
> >> > Developer-1 did "gitmerge"....."gitmerge <remote-name>/<branch-
> >> > name>"
>
> >> In this case I would recommend to rather use "gitrebase" instead of
> >> "gitmerge".
> >> With "gitrebase" you avoid having the merge commit and I think it
> >> also makes reviewing easier (since the reviewer can see delta to the
> >> latest central state andnotto some historic state on which the
> >> feature was originally developed).
>
> >> > d) With "gitmerge", Developer-1 got conflicts.
> >> > e) Developer-1 resolved the conflicts and did "gitcommit".....then,
> >> > the log has "merge commit" as latest.
> >> > f) Again Developer-1 made changes in some file and commited them.
> >> > g) Finally, when Developer-1 tries topush(gitpush<remote-name>
> >> > HEAD:refs/heads/<branchname>), he is gettingerrorlike......"you are
> >> >notallowedtouploadmerges".
Reply all
Reply to author
Forward
0 new messages