by edavis · 2y ago · 0 comments
Now the first time I commit in a new repo, it errors out with "Author identity unknown" and I punch in "git config user.email ADDR" for the email I want to use and re-run the commit.
I just use different accounts depending on the context, usually by either SSH or by starting a Docker container with all the environment already configured.
At least for me, using different identities[1] when I want to use different identities[2], seems less brittle and less likely for my future self to accidentally forget to do something (e.g. change a config when I reinstall an OS).
[1]: OS user, directly (SSH) or indirectly (container).
[2]: Email address, username, etc.
I’ve tried conditionally setting email based on the remote [1], but for some reason I did not manage to make it work. I didn’t try too hard, and I might try again with more patience.
[1] https://www.brantonboehm.com/code/conditional-git-config/