Skip to content

Instantly share code, notes, and snippets.

@but80
Created June 20, 2018 23:29
Show Gist options
  • Save but80/988bcc90e58ad20d50dd1fe88ad58a7a to your computer and use it in GitHub Desktop.
Save but80/988bcc90e58ad20d50dd1fe88ad58a7a to your computer and use it in GitHub Desktop.
gitリポジトリごとに明示的なユーザ名の設定を求める
  1. $HOME/.git_template/hooks/pre-commit を設置

  2. $HOME/.gitconfig に以下を追記

    [init]
        templatedir = ~/.git_template
    
#!/bin/sh
if [ -z "`git config --local user.name`" ]; then
echo "fatal: user.name is not set locally" >&2
exit 1
fi
if [ -z "`git config --local user.email`" ]; then
echo "fatal: user.email is not set locally" >&2
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment