I have an account on Github, Bitbucket, and Gitlab. Within my '.gitconfig' file, I have a setup like this, which involves Git automatically switching emails depending on the URL, looks something like this:
[includeIf "hasconfig:remote.*.url:https://github.com/**"]
path = C:/Users/(User)/.gitconfig.github
[includeIf "hasconfig:remote.*.url:https://gitlab.com:/**"]
path = C:/Users/(User)/.gitconfig.gitlab
[includeIf "hasconfig:remote.*.url:https://bitbucket.org/**"]
path = C:/Users/(User)/.gitconfig.bitbucket
This goes into a specific file and gets my username and email address being used on the designated platform (through which the email specifically, is different)
[user]
name = (Name)
email = (Email)
Now, how would I get this to work when I'm dealing with SSH keys, in which I would want Git to automatically switch emails depending on the platform I'm using? I've tried including things like:
[includeIf "hasconfig:remote.*.url:[email protected]:**"]
path = C:/Users/(User)/.gitconfig.github
within the '.gitconfig' file, but as expected, it wasn't able to get the exact username and email address that's designated to the platform
includeIf
should be used to distinguish personal emails from the work ones. May be different project emails. But hostings? Why? – Dodds