linux – 如何阻止在远程主机上分支
发布时间:2020-12-13 19:40:26 所属栏目:Linux 来源:网络整理
导读:有没有办法阻止代码推送直接掌握?我尝试在.git / hooks / update中添加一个脚本: #!/bin/shif [ $USER != "git-repo-admin" ];then if [ "$1" == refs/heads/master ]; then echo "Manual pushing to this repo is restricted" exit 1 fifi 但这不行 – 每
有没有办法阻止代码推送直接掌握?我尝试在.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 但这不行 – 每个人都可以推.我只想允许特定用户推送以阻止他人. 解决方法
原始脚本是完美的,我只需要将其从.git / hooks / update.sample重命名为远程服务器上的.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 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |