Created
April 25, 2019 10:18
-
-
Save hnq90/8d6043390ce2a74a1c1222210f7ca502 to your computer and use it in GitHub Desktop.
Rikkeisoft GitHub Pre-Push Hook
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# HOW TO USE: Copy this file to `.git/hooks` in your project directory. | |
remote_url="$2" | |
warning="[Warning] Don't push the project' source code to GitHub unless you are allowed." | |
policy_url="Rikkeisoft's IPR Regulation: https://rikkei.vn/help/view/97" | |
prompt_user() { | |
echo $warning | |
echo $policy_url | |
read -n1 -p "Do you want to CONTINUE pushing? [Y/n]" answer < /dev/tty | |
echo | |
echo $answer | |
if [[ $answer == 'Y' ]]; then | |
exit 0 | |
fi | |
exit 1 | |
} | |
if [[ $remote_url =~ 'github.com' ]]; then | |
prompt_user | |
fi | |
unset prompt_user | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment