fi if [[ $(git diff-tree –name-only –diff-filter=A -r $range) =~ (\.exe$|\.sh$) ]]; then echo “Error: 不允许提交.exe或.sh文件!” >&2 exit 1 fi done exit 0 “` 保存并修改钩子脚本的执行权限: “` sudo -u git chmod +x /home/git/repositories/myproject.git/hooks/pre...