Skip to content

Instantly share code, notes, and snippets.

@pasela
Last active December 27, 2015 10:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pasela/7313176 to your computer and use it in GitHub Desktop.
Save pasela/7313176 to your computer and use it in GitHub Desktop.
[git] Prevent commits from default user.
#!/bin/sh
git config user.name >/dev/null && git config user.email >/dev/null
if [ $? -ne 0 ]; then
cat <<EOF
Error: Attempt to commit by default user.
$GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>
Please set user.name and user.email using following commands.
git config user.name <YOUR_NAME>
git config user.email <YOUR_EMAIL>
EOF
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment