Need help in pushing new branches to gerrit

17,231 views
Skip to first unread message

hari

unread,
Jul 26, 2010, 4:41:19 PM7/26/10
to Repo and Gerrit Discussion
Hi,

Say I have a repo configured in gerrit with a master branch. Now I
clone this repo to have my own local master branch and I do code
changes on this master branch and pushing this branch to gerrit works
perfectly fine. But if I do a "git chekcout -b new_branch" and work on
my new branch and when trying to push this branch to gerrit, am
getting this error:

! [remote rejected] HEAD -> refs/for/hari_spec-live (branch hari_spec-
live not found)


So my requirement is to be able to push whatever branch I create in my
local clone to gerrit. Please let me know how to accomplish this.


Thanks,
Hariharan.B

Shawn Pearce

unread,
Jul 26, 2010, 4:46:17 PM7/26/10
to hari, Repo and Gerrit Discussion
On Mon, Jul 26, 2010 at 13:41, hari <bhh...@gmail.com> wrote:
> Say I have a repo configured in gerrit with a master branch. Now I
> clone this repo to have my own local master branch and I do code
> changes on this master branch and pushing this branch to gerrit works
> perfectly fine. But if I do a "git chekcout -b new_branch" and work on
> my new branch and when trying to push this branch to gerrit, am
> getting this error:
>
> ! [remote rejected] HEAD -> refs/for/hari_spec-live (branch hari_spec-
> live not found)

The branch doesn't yet exist on Gerrit. To prevent typos, Gerrit
requires that the branch exist when you upload a change to it for
review. You'll need to create the branch hari_spec-live through the
Admin > Projects > Branches tab in the web UI before you can push to
it and create changes.

hari

unread,
Jul 26, 2010, 5:40:38 PM7/26/10
to Repo and Gerrit Discussion


On Jul 26, 1:46 pm, Shawn Pearce <s...@google.com> wrote:
Thanks Shawn .. do we have any gerrit commands to do this from
backend, that would be lot easier for the developers to create a
branch whenever needed, rather than logging on to gerrit everytime..

Shawn Pearce

unread,
Jul 26, 2010, 5:48:00 PM7/26/10
to hari, Repo and Gerrit Discussion

If the user has Push Branch +2 permission, they can first create the
branch by pushing a commit to it, then pushing the review commit. For
example:

$ git push origin origin/master:refs/heads/hari_spec-live
$ git push origin HEAD:refs/for/hari_spec-live

hari

unread,
Jul 26, 2010, 7:03:22 PM7/26/10
to Repo and Gerrit Discussion


On Jul 26, 2:48 pm, Shawn Pearce <s...@google.com> wrote:
Thanks once again Shawn, I will try this option... btw earlier when I
was using older versions of gerrit 2.1.2 and when pushing to gerrit
from the backend I used to get the code-review link in my push ouput.
But looks like am not getting that when pushed from 2.1.3. Is this
feature removed in this version or is there something I need to setup ?

Shawn Pearce

unread,
Jul 26, 2010, 7:11:16 PM7/26/10
to hari, Repo and Gerrit Discussion
On Mon, Jul 26, 2010 at 16:03, hari <bhh...@gmail.com> wrote:
>
> Thanks once again Shawn, I will try this option... btw earlier when I
> was using older versions of gerrit 2.1.2 and when pushing to gerrit
> from the backend I used to get the code-review link in my push ouput.
> But looks like am not getting that when pushed from 2.1.3. Is this
> feature removed in this version or is there something I need to setup ?

Is it possible that gerrit.canonicalWebUrl isn't set in your
gerrit.config? Over SSH we don' t know how to contact the server via
HTTP, so the only way the outgoing emails can contain the URL is if
its been configured by the administrator.

Reply all
Reply to author
Forward
0 new messages