Git – How to push Drafts to Gerrit

gerritgit

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?

Best Answer

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