I used to make git commits only with my personal email address. Now I have started working as a software developer. I want to use my work email address for my work repositories and my personal email address for personal repositories. I use git config user.email "username@example.com" to do this. The problem is that I have a lot of repositories and I sometimes forget to set user.email. Sometimes, I commit and push with the wrong email address.
Is there a way to force git to not allow me to commit if user.email is not explicitly set for a repository? I removed user.email from my global ~/.gitconfig, but then git uses username@hostname.local as my commit email address.
I'm using git version 2.18.0 on MacOS High Sierra. I installed git using homebrew.