Some times we need to manage more than one ssh key. There may be many scenario like you are having more than 2 github account or you have an account and your client want to add your ssh key to their github account. In past I faced same kind of issue and found solution.
Here I am assuming that you have a ssh key already. Now you can generate a new key with different name executing
ssh-keygen -f ~/.ssh/keyname -C "keyname"
Now got to .ssh dir and create a file using
touch config
Now open the file and add the following
Host github.com HostName github.com PreferredAuthentications publickey IdentityFile ~/.ssh/keyname
Now you can add new ssh key to new git account. And both key will work. For git account it will give the preference to “keyname” key and if auth will fail then it will try to another key.
By following about step we can mange multiple key.
Hope it will help someone.
Recent Comments