I don't have any global user.email or global user.name setup on purpose.
I like to set my user.email and user.name per repo by using the git config user.email and git config user.name commands.
On macOS with git version 2.17.0, if I forget to set user.email or user.name for a repo on my Mac, when I run git commit I get this error:
*** Please tell me who you are.
Run
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
to set your account's default identity.
Omit --global to set the identity only in this repository.
fatal: unable to auto-detect email address (got 'lone@mymac.(none)')
This is good because it reminds me that I need to set the user.email and user.name config for my repo.
But on my Debian system with git version 2.11.0, if I forget to set user.email or user.name for a repo, whe I run git commit it commits the change with Lone Learner <lone@mydeb> as the author. I am guessing that it auto-detects user.name from /etc/passwd and auto-detects user.email as <user>@<host>.
I would like to disable this auto-detection of user.name and user.email on Debian or any system Git is on. If I have not explicity set user.name or user.email I want Git to fail in the manner it fails as shown in the Mac example above or in some other way. Is there anyway to achieve this either using ~/.gitconfig or some other way?