Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to push tag to specific branch in gerrit

Tags:

git

gerrit

I have a branch called v2.0 in gerrit. Now I want to the current stat of this branch as v2.0.1.

In my local repository I checked out the branch, then added the tag using

git tag v2.0.1

Now I'm trying to push that to gerrit, but I'm not sure how. I tried this:

$ git push origin v2.0.1 HEAD:refs/heads/v2.0
! [remote rejected] v2.0.1 -> v2.0 (prohibited by Gerrit)

How can I push the tag to gerrit?

like image 567
Frank Avatar asked Jul 30 '13 17:07

Frank


People also ask

How do you push tags to Gerrit?

If you push a lightweight tag, you should add the privilege 'Create Reference' for the reference name refs/tags/* , because as CharlesB said, both tags and branches are references. After adding the 'Create Reference' right, you can use git push --tags to push lightweight tags.

How do I push a tag to a remote branch?

Push all git tags to remote And if you want to push all tags from your local to the remote then add "--tags" to the git command and it will push all tags to the remote.


2 Answers

After some googling, I found the answer:

gerrit accepts only annotated tags. It's quite straightforward to create and push an annotated tag:

git checkout v2.0
git tag -am "Adding v2.0.1 tag" v2.0.1
git push origin v2.0.1 HEAD:refs/heads/v2.0
like image 111
Frank Avatar answered Sep 21 '22 06:09

Frank


  1. Add the permissions:

Click your project Access, add permissions as following:

Reference:  
refs/tags/*

Push Annotated Tag 
Push Signed Tag 
  1. Add your tags

Annotated tag: git tag -a "message" tag_name

Signed tag: git tag -s tag_name

  1. push your tags

simple cmd: git push --tags

If you want to fetch tags from your server repo using cmd:

git fetch --tags

You can check the doc:

https://review.typo3.org/Documentation/access-control.html#category_push_annotated https://review.typo3.org/Documentation/access-control.html#category_push_signed

like image 28
lijinma Avatar answered Sep 18 '22 06:09

lijinma