### Situation There are plenty of references for generating and using SSH keys on MacOS. Google for answers and they're everywhere. What is less obvious is how to use multiple SSH keys, especially for the same host, e.g. GitHub. I had multiple SSH keys and a `~/.ssh/config` file, but certain of the credentials weren't being found. ### Solution The nuggets of goodness I found describe how to properly use `~/.ssh/config` - ([here](https://gist.github.com/Jonalogy/54091c98946cfe4f8cdab2bea79430f9), [here](https://medium.nextlevelswift.com/creating-two-ssh-keys-on-mac-for-two-different-github-accounts-b2456734e8f1), [here](https://pratapsharma.io/github-miltiple-key), [ here](https://gist.github.com/jmcaldera/e445ff878c81e16d0c19b4049f009703)... +[many more](https://www.google.com/search?q=macos+ssh+github+multiple+keys)). The key is actually _**using**_ the resulting `Host` aliases! Go figure, huh? :facepalm: ### Example: Github - SourceTree In concrete terms, and skipping all the SSH generation tasks — references abound — the key insight in code is... Add the host-key mappings to `~/.ssh/config`, ``` Host github-alias-1 HostName github.com ... IdentifyFile ~/.ssh/key1 Host github-alias-2 HostName github.com ... IdentifyFile ~/.ssh/key2 ``` Then anywhere you would normally reference the url host directly... don't. Use the `Host` alias from the config file instead, - NO: `git@`**github.com**`:username/repository.git` - YES: `git@`**github-alias-x**`:username/repository.git` It's magical. :magic_wand: