Is there any way to block code push directly to master? I tried adding a script in .git/hooks/update
:
#!/bin/sh
if [ $USER != \"git-repo-admin\" ];
The original script was perfect, I just needed to rename it from .git/hooks/update.sample
to .git/hooks/update
on the remote server and make sure it's executable.
#!/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