有没有办法阻止代码直接推送到master?我尝试在.git/hooks/update以下位置添加脚本:
#!/bin/sh
if [ $USER != "git-repo-admin" ];
then
if [ "$1" == refs/heads/master ];
then
echo "Manual pushing to this repo is restricted"
exit 1
fi
fi
Run Code Online (Sandbox Code Playgroud)
但这不起作用 - 每个人仍然可以推动.我想只允许特定用户推送到主人并阻止他人.