27
votes

I am unable to push the Drafts to gerrit. When I try to push drafts to gerrit it is throwing the following error.

[3:37pm] [myrepo] -> git push origin HEAD:refs/drafts/remote Counting objects: 167, done.

Delta compression using up to 8 threads.

Compressing objects: 100% (80/80), done.

Writing objects: 100% (124/124), 58.19 KiB, done.

Total 124 (delta 75), reused 47 (delta 32)

remote: Resolving deltas: 34% (26/75)

To ssh://myrepo ! [remote rejected] HEAD -> refs/drafts/remote(prohibited by Gerrit)

error: failed to push some refs to 'ssh://myrepo'

Can some one help me out in this issue?

1
Thomas Mtthews:In simple terms,Gerrit is an Web based tool where you can push your code changes so that other team members will review the changes and approve or reject if any errors are there.Bobby

1 Answers

48
votes

use this command:

git push --receive-pack="git receive-pack" origin {commit SHA-1 or HEAD}:refs/drafts/{branch}

A general rule to push into gerrit, branch = master:

git push origin <a_local_branch_name or specific_commit or HEAD>:refs/for/master

A general rule to push into gerrit as DRAFT, branch = master:

git push origin <a_local_branch_name or specific_commit or HEAD>:refs/drafts/master