Is there a way to lock a GIT tag?

3.8k views Asked by At

I would like to be able to lock a GIT tag so that it cannot be moved or deleted for product release control. I thought I would be able to do this with a Lightweight Tag based on the documentation but found by experiment that Lightweight Tags can also be moved.

1

There are 1 answers

1
larsks On BEST ANSWER

You can't prevent some one from updating tags in their local copy of the repository.

You could prevent people from pushing tag updates to a remote repository by putting an update hook on the remote repository. This question has some ideas that might get you started on this path.

Depending on what you're trying to do you could also consider using signed tags (git tag -s ...); this creates a tag that is cryptographically signed using GPG. With an appropriate GPG configuration you can verify that a tag has been signed by a trusted party. This article discusses the use of signed tags.