Managing Git Identities

If you'd like to keep your real life and modding identities separate, Git and ssh let you manage different identities on a per-folder basis. Here I give advice on how to configure it to require no active upkeep - you just go to the correct repo and it uses the correct identity.

Configuring name/email per folder
(Here I will use OrderedSet as it is my dev identity; replace it with your own when you are doing this.)

Create a ~/.gitconfig file and populate with the paths you want to store your different identities in. When you are in the "includeIf" folder or any of the children folders, it will use the path you specify to populate the user.name and user.email fields: Here ~/.gitconfig-public defines my real name account details and ~/.gitconfig-orderedset defines my dev / OrderedSet account details.

Now fill the paths you defined with your name/email: Now this will use your dev identity for all commit signing in those folders/child folders:

Managing multiple SSH keys
When pushing to Git, you should use SSH keys associated with your account. If you have multiple identities and you wish to use separate SSH keys, here is how I handled it.

First generate a new key like so, replacing orderedset with your details:

ssh-keygen -t ed25519 -C "orderedset86@gmail.com" -f ~/.ssh/orderedset-id_ed25519

This will create a new public and private key under ~/.ssh: Now open up ~/.ssh/config and define aliases for when to use the key identities: Now if you push to git@github.com (the default URL you paste from Github), it will use the public identity, and if you push to git@orderedset, it will use the OrderedSet / dev identity.

Now modify your dev git repos to point to the new remote using "git remote set-url origin git@orderedset:OrderedSet86/gtnh-flow.git" (replacing with your ID alias and git repo URL): Done! Now you are using a unique name, email, and SSH key for your dev identity, and it automatically does this without any active switching IDs. Just go to the correct folder/git repo and it does it automatically.