Reputation: 55
I've created two different SSH keys. One for an account on Github, and another for a local git server. They were created at different times, and both had the name id_rsa.
I now need to access both of these accounts under the same username. I've followed this similar problem in an attempt to resolve my problem. It does not seem to work.
The problem seems to be renaming my keys. When I change the name on either key to something other than "id_rsa", the link between me and the Git server breaks. As soon as I change it back, the link will be restored. I tried putting them in their own directories within my .ssh folder so that they can keep their original file names, but both ended up breaking.
Does the filename of my public key on the host servers need to match the file name on my computer?
Upvotes: 1
Views: 190
Reputation: 141986
When you have multiple identity files, create a SSH config file mechanisms to create aliases for your various identities.
You can construct a SSH config file using many parameters and different approaches.
The format for the alias entries use in this example is:
Host alias HostName github.com IdentityFile ~/.ssh/identity
To create a config file for two identities (workid and personalid), you would do the following:
Open a terminal window.
Edit the ~/.ssh/config file.
If you don't have a config file, create one.
Add an alias for each identity combination for example:
Host workid
HostName github.com
IdentityFile ~/.ssh/workid
Host personalid
HostName github.com
IdentityFile ~/.ssh/personalid
Don't forget to load the keys to your github account.
Upvotes: 1