有什么方法可以将代码直接推送给主服务器吗?我尝试在添加脚本.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
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句