I have several Github accounts and some of them are for open source repos and I use ssh keys for all of them. I'm constantly swapping workplaces and each time I need to be careful to set git config user.name
and git config user.email
correctly
We're using CommitLint and Husky
Is there a way to add a rule that doesn't allow you to commit unless your user.email
and user.name
matches the one I want?
Endgoal is to ensure that all commits, teammates' or mine, are always on the correct user.name
/user.email
You can try a conditional include config file, based on, for instance, the path of the repository, in order to include the right config
user.name/email
setting?You can see an example in "Is it possible to specify different names and emails per git server (using subconfigs)?".