How to push Drafts to Gerrit?

Bobby picture Bobby · Aug 7, 2013 · Viewed 69.1k times · Source

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?

Answer

elhadi dp ıpɐɥןǝ picture elhadi dp ıpɐɥןǝ · Oct 3, 2013

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