Blocking pushes to master
This commit is contained in:
parent
994c3c9f96
commit
41f0b30818
@ -1,3 +1,25 @@
|
|||||||
|
# Add the git hooks to the local repo. This prevents pushes on master
|
||||||
|
SCRIPTDIR="$(dirname "$0")"
|
||||||
|
HOOKDIR="$SCRIPTDIR/.git/hooks"
|
||||||
|
SCRIPT="$HOOKDIR/pre-push"
|
||||||
|
cat << EOF > $SCRIPT
|
||||||
|
#!/bin/bash
|
||||||
|
protected_branch='master'
|
||||||
|
# check each branch being pushed
|
||||||
|
while read local_ref local_sha remote_ref remote_sha
|
||||||
|
do
|
||||||
|
remote_branch=$(echo $remote_ref | sed -e 's,.*/\(.*\),\1,')
|
||||||
|
if [ $protected_branch = $remote_branch ]
|
||||||
|
then
|
||||||
|
echo "ABORT PUSH: Not allowed to push directly to $protected_branch. Use --no-verify to force."
|
||||||
|
exit 1 # push will not execute
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
exit 0
|
||||||
|
EOF
|
||||||
|
|
||||||
|
chmod +x $SCRIPT
|
||||||
|
|
||||||
# Remove the running container so we cna re-use the container name 'dragon-bot'
|
# Remove the running container so we cna re-use the container name 'dragon-bot'
|
||||||
printf "\n[-] Deleting old dragon-bot container from system\n"
|
printf "\n[-] Deleting old dragon-bot container from system\n"
|
||||||
docker rm -f dragon-bot-test
|
docker rm -f dragon-bot-test
|
||||||
|
Loading…
x
Reference in New Issue
Block a user