Cannot push tags in Git
Asked Answered
I

5

9

I am unable to push the annotated tag in my git remote repository. All the access permission have been provided in gerrit. eg. [refs/*]

I am creating the tag using the below command

git tag -a v1.0 -m 'Base Version' 712d77e

When i try to push using the below commands

git push origin v1.0 

or

git push origin --tags

I get the following error.

Counting objects: 1, done.
Writing objects: 100% (1/1), 157 bytes, done.
Total 1 (delta 0), reused 0 (delta 0)
remote: Processing changes: refs: 1, done
To ssh://...
! [remote rejected] v1.0 -> v1.0 (prohibited by Gerrit)
error: failed to push some refs to 'ssh://...'

Please let me know how I should be able to push tags in repository.

Thanks....

Iamb answered 9/5, 2013 at 15:18 Comment(1)
Why not first just try from the terminal? If it works then you can narrow down the issue to gerritSawfly
A
20

This is a general error message that is returned by Gerrit if a push is not allowed, e.g. because the pushing user has no sufficient privileges.

In particular this error occurs:

  1. If you push a commit for code review to a branch for which you don’t have upload permissions (access right Push on refs/for/refs/heads/*)

  2. if you bypass code review without Push access right on refs/heads/*

  3. if you push an annotated tag without Push Annotated Tag access right on refs/tags/*

  4. if you push a signed tag without Push Signed Tag access right on refs/tags/*

  5. if you push a lightweight tag without the access right Create Reference for the reference name refs/tags/*

  6. if you push a tag with somebody else as tagger and you don’t have the Forge Committer access right for the reference name refs/tags/*

  7. if you push to a project that is in state Read Only

For new users it often happens that they accidentally try to bypass code review. The push then fails with the error message prohibited by Gerrit because the project didn’t allow to bypass code review. Bypassing the code review is done by pushing directly to refs/heads/* (e.g. refs/heads/master) instead of pushing to refs/for/* (e.g. refs/for/master).

copied from prohibited by Gerrit

More description: I have same problem with new installation of gerrit 2.7, searched and found this stackoverflow question, but my case was number 5 of this description(light weight tags), so i added Create Reference permission for refs/tags/*, and problem solved.

Andresandresen answered 18/11, 2013 at 7:13 Comment(1)
I can't find any permission called "Push Annotated Tag" in my Gerrit. Did you mean "Create Annotated Tag"? (I realize the answer is old, maybe the permission's name has changed?)Placable
M
3

You need to add the following project's permissions for [refs/tags/*]:

  • Create Reference: to create a new tag.
  • Forge Committer Identity: allow different tag uploader (you) to original tagger.
  • Forge Author Identity: allows handling of commit belonging to other users.

Refer to Gerrit access controls for details

Method answered 14/7, 2015 at 9:12 Comment(0)
M
2

This line gives you a hint:

! [remote rejected] v1.0 -> v1.0 (prohibited by Gerrit)

Gerrit prohibited the push as your user is not in a group with the "Push Annotated Tag" right.

Murk answered 9/5, 2013 at 15:50 Comment(1)
adding forge author identity and forge commiter identity helped us push the annoatated tagsIamb
D
1

Create annotated and Check gerrit. You must be in right group which is allowed to create annotated

If you create simple tags gerrit may reject that refs, but again it might depends on gerrit configuration.

create annotated tag:

git tag -a  -m "Some message" 

push all your tags:

git push --tags

check tags are created in remote:

git ls-remote --tags
Deluna answered 23/10, 2015 at 10:0 Comment(0)
A
1

"prohibited by Gerrit" - means that has to allow rights.

First select your project and go to "Access". Then "Edit" and from drop-down "add permission" . Than has to add the three permissions on the picture with the arrows.


enter image description here


Than you can use in terminal:

git push origin --tags

!!! IMPORTANT Notice that rights are for refs/tags/*

Arthromere answered 16/8, 2017 at 12:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.