To push a tag to a remote repository using Git, you can use the git push
command with the --tags
option. Here’s an example:
First, create a tag:
git tag v1.0.0
This will create a tag with the name v1.0.0
for the current commit.
Push the tag to the remote repository:
git push origin v1.0.0
This will push the tag v1.0.0
to the remote repository named origin
. If the tag doesn’t exist on the remote repository, it will create a new tag with the same name.
Alternatively, you can push all local tags to the remote repository using the --tags
option:
git push --tags
This will push all local tags to the remote repository named origin
.
Note that when pushing tags, you don’t need to use the --force
option, as tags are intended to be immutable references to specific commits.