ERROR: Updates were rejected because the tag already exists in the remote

Good morning Jenkins people,
after merged some changes in Gerrit, the consequent Jenkins pipelines triggered is giving me this error.
A problem with git tag. Do you know how to solve it?
Thanks,
Mario Raimo

You are trying to push a tag already present in the remote, this means your local repository and the remote are out of sync. You can force push but it is not really advised, I would suggest to fetch the tags before creating yours locally with “git fetch --tags”, Optionally you can delete your stale tags in local with “git fetch --prune-tags”.

Thank you so much for your kind reply Giovanni. Just to understand properly: so is the problem at pushing level? Because a first triggered jenkins pipeline after the push, which produced a snapshot seemed to work properly, this second pipeline, coming as a result of a merge operation of the changes in Gerrit, failed. Is the problem to be solved, in any case, at the pushing levels? Could I work with this “git fetch --tags”, make another little change to be pushed, push that change and try to see this will overcome the problem?

It would be useful to understand what is Gerrit exactly pushing. Are you creating tags every time the code is merged into a specific branch or what?.