Say, I create a new repo, and try to commit. Git shows me
*** Please tell me who you are. Run git config --global user.email "email@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.
Without reading the last line, I run the two lines suggested by git (with
--global) and happily commit.
A week later I create a new repo for a completely unrelated project where I'd need to commit under a different
user.email. Without even thinking about
user.email, I try to commit, it goes through and I push to the origin.
The above happened to me twice and made me think whether there is a way to disallow
git config --global.
For example, if I run
git config --global user.email "firstname.lastname@example.org"
I'd like bash not to run the command and show me a warning, but when I run
git config user.email "email@example.com"
I'd like it to go through.
Is it possible?