Working on many projects across multiple identities can be difficult to manage. So here is a simple solution to do a per-directory global git configuration.
.gitconfig, you say:
[user] name = Me Myself email = firstname.lastname@example.org signingkey = D34DB44F [includeIf "gitdir:~/src/github.com/work_org/"] path = ~/.gitconfig_work
[user] name = Me Myself email = email@example.com signingkey = D34DC0D4 [core] sshCommand = ssh -i ~/.ssh/work_ed25519
I like this way better, because I don’t need to remember to specify per-project config, as long I put them in the right directory :-)
While this works great if you are using your personal computer to do work. But if you use your employer issued computer to do personal hobby project, then please be very careful. In 90%+ of the cases your contract with your employer have the clause saying (please review your contract to clarify) that they own copyright of all your work while you are under the contract even if it’s outside of working hours or on the weekend, with a few exceptions, and using employer equipment (employer issued computer) nullify one of the biggest exceptions.