Search code examples
gitgerritgit-rebase

gerrit ! [remote rejected] HEAD -> refs/for/dev (branch dev not found) error: failed to push some refs to 'project'


I have a master branch and dev branch, i also confirmed by checking by git-branch.

In my master branch there is current working version of the code.

I created new branch dev and then rebased to dev branch

Now I have the same files in master and dev branch and i planned to work on dev branch. the reason doing like this pushing to dev branch can be done without reviews and pushing to master needs review.

I havent done any changes in dev branch as of now but wanted to push this to dev branch as everyone can see this dev branch . then i get error like (this below error came when i did git push origin dev)

remote: Resolving deltas: 100% (7/7)                                                                                     
remote: error: branch refs/heads/dev:                                                                                       
remote: You need 'Create' rights to create new references.                                                              
remote: User: aravmadd                                                                                                  
remote: Contact an administrator to fix the permissions                                                                 
remote: Processing changes: refs: 1, done       
    
gerrit ! [remote rejected] HEAD -> refs/for/dev (branch dev not found) error: failed to push some refs to 'project'

But i have all rights required, except that i didnt create this repository

when i tried to use git push origin HEAD:refs/for/dev then i get error like

 ! [remote rejected] HEAD -> refs/for/dev (branch dev not found) 

What i did was i created new branch dev and rebased

git checkout dev
git rebase master dev

$ git status
On branch dev
nothing to commit, working tree clean

$ ls
CMakeLists.txt  doc/  extern/  modules/  Readme.md  README.txt  test/

then i can see the same files in master and dev branch.

for your information, master branch is properly reviewed.

Then i decided this to push since everything i changed was in my localpc.

Am i doing something wrong??.

Any help is much appreciated


Solution

    1. The "dev" branch doesn't exit on Gerrit, you just created it locally in your machine.

    2. When you pushed to "refs/heads/dev" you tried to create the "dev" branch on Gerrit but you don't have permission to create branches. You need to have "Create Reference" permission on "refs/*".

    3. It's not possible to push to "refs/for/dev" (create a review on Gerrit) because the "dev" branch doesn't exist in Gerrit (see 1. above).