Last active
May 5, 2018 11:36
-
-
Save kuronekomichael/808d18c401056945b7a4 to your computer and use it in GitHub Desktop.
user.nameやuser.emailが設定されていない時は、git commitを失敗させるフック
This file contains hidden or 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/sh | |
# 一時フォルダの場合は特に制限を入れない | |
if [[ $PWD =~ ^/private/var/folders/ ]] ; then | |
exit 0 | |
fi | |
if [ -z "`git config --local user.name`" ]; then | |
echo "\033[31m ✗ FATAL: user.name is not set locally \033[0m" | |
echo "\033[35mgit config user.name {your-name}\033[0m" | |
echo "\033[35mgit config user.email {[email protected]}\033[0m" | |
exit 1 | |
fi | |
if [ -z "`git config --local user.email`" ]; then | |
echo "\033[31m ✗ FATAL: user.email is not set locally \033[0m" | |
echo "\033[35mgit config user.name {your-name}\033[0m" | |
echo "\033[35mgit config user.email {[email protected]}\033[0m" | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
see http://qiita.com/uasi/items/a340bb487ec07caac799