Rai King
Rai King

Reputation: 155

Failed to push some refs to remote repository (prohibited by Gerrit)

I know this might have been asked before but I would like to understand the issue. I am trying to push a newly-created branch from my local repository to the remote repository. Here are the actions that I've taken:

  1. Create a clone repository in my local system.
  2. Create a new branch locally (named here as 'Newbranch'). Note that the branch is not existing in the remote repository.
  3. Push Newbranch to the remote repository.

I received this error message after making the push:

Total 0 (delta 0), reused 0 (delta 0)
remote: Processing changes: refs: 1, done
To 'remote repository URL'
! [remote rejected] Newbranch -> Newbranch (prohibited by Gerrit)
error: failed to push some refs to 'remote repository URL'

Can someone walk me through the error code? What steps are needed to be taken to resolve and to be able to create a new branch in the remote? I'm just starting to use Git. If this will help, the git repository is powered by Gerrit Code Review. Your response will be highly appreciated.

Upvotes: 2

Views: 14555

Answers (2)

Mike Frysinger
Mike Frysinger

Reputation: 3072

please post the exact command you ran. most likely you didn't push using the full namespace. gerrit tends to be picker because it's a review system first and a git hoster second.

i.e. if you want to push commits for review, you would normally run:

git push origin HEAD:refs/for/master

that means take all the commits you have in your current checkout point and upload them for merging into the master branch.

note: origin here is the shortname given to the remote repository by default. in your case, it might be something else, so adjust accordingly (such as using the full URI to the remote repo).

Upvotes: 3

Farhad
Farhad

Reputation: 12986

For creating and pushing a new branch to the remote repository, you should :

git checkout -b [new_branch_name]

git push -u origin [new_branch_name]

For resolving the error you are facing :

[remote rejected] Newbranch -> Newbranch (prohibited by Gerrit) error: failed to push some refs to 'remote repository URL'

you should check your user credentials with the system administrator, since he should first grant the permission to create a new branch, to your user account.

The permission configurarion for Gerrit is completely explained in the documentations.

Upvotes: 1

Related Questions