问题
Is there any way to restrict people from pushing tags in git repository ? In bitbucket under "branch management" there is an option to allow branch access , but by disabling it even code push is failing. Thanks in advance for your help.
回答1:
You may write some git update hook:
#!/bin/sh
if [ $USER != "git-repo-admin" ];
then
if [ "$1" == refs/tags/* ];
then
echo "Tag push is restricted"
exit 1
fi
fi
来源:https://stackoverflow.com/questions/35335787/git-how-to-restrict-tag-push