Git : How to restrict tag push

你。 提交于 2019-12-13 02:27:09

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!