At 11:59 +0200 10 Aug 2013, Michael Haggerty <mhagger@xxxxxxxxxxxx> wrote:
I intentionally don't set user.email in my ~/.gitconfig because I use different identities (on the same machine) depending on what project I am committing to (open-source vs. work). After I clone a repo, I *rely* on Git reminding me to set user.email on my first commit, because I invariably forget to set it myself. And for me, *any* universal, heuristically-determined email address would be wrong for me for at least some repos.
I was in a similar situation for awhile. Except in my case I had $EMAIL set for other reasons, so I didn't get the reminder even if git wasn't configured.
The solution I came up with was to use a template directory to have the following script installed as a pre-commit hook in all new repos:
#!/bin/sh git config user.email > /dev/null && exit echo 'Set email address with `git config user.email` first' >&2 exit 1 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html