28

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?

Mureinik
  • 297,002
  • 52
  • 306
  • 350
Bobby
  • 281
  • 1
  • 3
  • 5
  • 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 Aug 14 '13 at 11:54

1 Answers1

49

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
elhadi dp ıpɐɥןǝ
  • 4,763
  • 2
  • 30
  • 34
  • But I am getting this error when I run the above mentioned command. esekilxxen1503 [10:47am] -> git push --receive-pack="git receive-pack" origin HEAD:refs/drafts/branch Total 0 (delta 0), reused 0 (delta 0) To ssh://user@gerritforge.lmera.ericsson.se:29418/branch ! [remote rejected] HEAD -> refs/drafts/com_33_rel (prohibited by Gerrit) error: failed to push some refs to 'ssh://user@gerritforge.lmera.ericsson.se:29418/ – Bobby Oct 18 '13 at 08:52
  • git push --receive-pack="git receive-pack" origin HEAD:refs/drafts/branch – Bobby Nov 01 '13 at 09:57
  • Have you a branch named "branch"? you want to push as draft to which branch if no? – elhadi dp ıpɐɥןǝ Nov 04 '13 at 09:59
  • 1
    Thanks for the reply elhadi :) Yes,I have a branch with the name as "branch" and i am pushing to that. – Bobby Nov 05 '13 at 16:30
  • so try: "git fetch"; then "git push origin :refs/drafts/branch" – elhadi dp ıpɐɥןǝ Nov 06 '13 at 09:30
  • i the above commands will not work, it seems that you have probably a permission issues, see this thread: http://stackoverflow.com/questions/9832348/git-push-rejected-error-failed-to-push-some-refs – elhadi dp ıpɐɥןǝ Nov 06 '13 at 09:33