Thread (11 messages) 11 messages, 6 authors, 2016-06-15

Re: git should not use a default user.email config value

From: Aaron Schrab <hidden>
Date: 2016-06-15 22:58:23

Possibly related (same subject, not in this thread)

At 11:59 +0200 10 Aug 2013, Michael Haggerty [off-list ref] 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help