Gerrit: remote rejected (you are not allowed to upload merges) even though I allowed "Push merge commit"
Asked Answered
A

5

15

I've configured Gerrit to allow Push Merge Commit on my branch, but I still get the following error when I try to push a merge commit:

! [remote rejected] ANDROID-foo -> ANDROID-foo (you are not allowed to upload merges)

I'm running Gerrit 2.8-1-gaa9367b.

Annihilator answered 18/1, 2014 at 3:56 Comment(0)
A
21

This is a bug in gerrit. The workaround is to create another reference named refs/for/refs/heads/<BRANCH_NAME>, and allow Push Merge Commit on it.

To be more specifically, add following lines in your project.config file

[access "refs/for/refs/*"]
  pushMerge = group <your-id-here>
Annihilator answered 18/1, 2014 at 3:56 Comment(3)
Note refs/for/refs/heads/<BRANCH_NAME>, i.e. plural 'heads' and not 'head'.Disembowel
I do not understand how to do this. Can someone help ?Chukker
Sometimes I really hate gerrit for these long-standing bugs. Although I really like it, I can't really recommend it for enterprise use..Chenoweth
H
5

Workaround which was more suitable for me as it doesn't involve knowing branches is to allow Push Merge Commit to refs/for/refs/heads/*. You probably won't want to be doing changing these for every branch specifically.

Heger answered 25/3, 2016 at 13:18 Comment(0)
K
5

It worked for me by this way(after this link):

  1. git stash
  2. git pull --rebase
  3. git push
  4. git pull
  5. git stash pop
Kazue answered 29/8, 2018 at 11:20 Comment(1)
"git pull --rebase" working here for me in such difficultyYokum
P
1

try to follow these steps:

enter image description here

try to apply these commands after shelving/stashing ur changes, once done, unshelve them and commit / push

Pubescent answered 2/1 at 10:20 Comment(0)
A
-3

First I reset the pointer to the commit of remote using soft mode, then I run

git add . 
git commit --amend
git push

It works for me. :)

Assassin answered 29/12, 2019 at 15:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.