Pushing a new branch

3,171 views
Skip to first unread message

James Englert

unread,
Jan 24, 2012, 11:39:04 AM1/24/12
to repo-d...@googlegroups.com
Hi Guys,

Hopefully a egregious oversight on my part, but how do you push a new branch using the command line:

[jenglert gerrit_training (tmp)]$ git push gerrit HEAD:refs/for/tmp
Total 0 (delta 0), reused 0 (delta 0)
To ssh://gerrit_host/gerrit_training.git
 ! [remote rejected] HEAD -> refs/for/tmp (branch tmp not found)
error: failed to push some refs to 'ssh://gerrit_host/gerrit_training.git'

I can create branches through the ui.

Thanks,

--
Jim Englert
Gilt Groupe
2 Park Ave South, 4th Floor
New York, NY 10011
M: 847-707-2942
Please accept my invitation to join Gilt:
http://www.giltgroupe.com/invite/jenglert

Martin Fick

unread,
Jan 24, 2012, 12:17:09 PM1/24/12
to repo-d...@googlegroups.com, James Englert
On Tuesday, January 24, 2012 09:39:04 am James Englert
wrote:

> Hi Guys,
>
> Hopefully a egregious oversight on my part, but how do
> you push a new branch using the command line:
>
> [jenglert gerrit_training (tmp)]$ git push gerrit
> HEAD:refs/for/tmp Total 0 (delta 0), reused 0 (delta 0)
> To ssh://gerrit_host/gerrit_training.git
> ! [remote rejected] HEAD -> refs/for/tmp (branch tmp not
> found) error: failed to push some refs to
> 'ssh://gerrit_host/gerrit_training.git'
>
> I can create branches through the ui.

I think that you cannot push to refs/for until the branch is
created. So, either create it through the WUI, or push the
starting point of the branch to refs/heads/tmp,

-Martin

--
Employee of Qualcomm Innovation Center, Inc. which is a
member of Code Aurora Forum

Matthias Sohn

unread,
Jan 24, 2012, 12:17:41 PM1/24/12
to James Englert, repo-d...@googlegroups.com
2012/1/24 James Englert <jeng...@gilt.com>

Hi Guys,

Hopefully a egregious oversight on my part, but how do you push a new branch using the command line:

[jenglert gerrit_training (tmp)]$ git push gerrit HEAD:refs/for/tmp
Total 0 (delta 0), reused 0 (delta 0)
To ssh://gerrit_host/gerrit_training.git
 ! [remote rejected] HEAD -> refs/for/tmp (branch tmp not found)
error: failed to push some refs to 'ssh://gerrit_host/gerrit_training.git'

I can create branches through the ui.

you try to push to the code review queue for a non-existing branch, 
instead try to push the base commit (the new branch should be based on)
directly (shortcutting code review) to the not-yet-existing branch:
$ git push gerrit <commit-id>:refs/heads/tmp
 
and you need appropriate permissions required to execute direct push
AFAIK for 2.1.x this is "Push Branch: +2 Create Branch"
and for 2.2.x  "Push" on the respective refs.

-- 
Matthias

Edwin Kempin

unread,
Apr 23, 2013, 12:30:02 AM4/23/13
to Jason Lee, Matthias Sohn, Repo and Gerrit Discussion, James Englert


On Apr 23, 2013 6:23 AM, "Jason Lee" <wua...@gmail.com> wrote:
>
> > git push origin HEAD:refs/heads/newBranch
> was not work too, return a error message "can not create new references".
> so, My question is, How can i create a remote branch using Gerrit? i search the web but not found any solutions, what a pity.
Looks like you didn't assign the Create Reference access right [1].

[1] http://gerrit-documentation.googlecode.com/svn/Documentation/2.6/access-control.html#category_create

> --
> --
> To unsubscribe, email repo-discuss...@googlegroups.com
> More info at http://groups.google.com/group/repo-discuss?hl=en
>  
> ---
> You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>  
>  

Reply all
Reply to author
Forward
0 new messages