How do I “upload” tags to Gerrit using repo?

2019-09-04 05:42发布

问题:

I have inherited an Android project that uses the Gerrit and Repo tools to manage the Git repositories on a VM. My normal work flow involves using the git add and git commit commands to work on my local branch and using repo sync and repo upload to update the remote. After repo upload I use Gerrit to approve changes for myself and others. This is working okay except that I cannot figure out how to upload the tags I have created on my local branch. I have tried using the git push --tags command directly but I get an error the the repository is not exported. I assume that is because the repo upload command does something different and the git push command is trying to violate the rules. I am obviously new to this and would appreciate any help. Thanks.

回答1:

For upload purposes, the Repo tool is only capable of uploading commits for review. It can't upload tags. You can use git push --tags just like you would with any other Git server. Just make sure you have the necessary permissions; in particular you'll need Push Annotated Tag for refs/tags/* (and probably Push Signed Tag too), Forge Author, and Forge Committer. The latter two are required for you to be allowed to upload tag objects created by someone other than yourself.