Skip to content

Instantly share code, notes, and snippets.

@jbaranski
Created August 1, 2020 14:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jbaranski/3b49aabba6695fbb442a3aa4397e1417 to your computer and use it in GitHub Desktop.
Save jbaranski/3b49aabba6695fbb442a3aa4397e1417 to your computer and use it in GitHub Desktop.
SSH Use Specific Private Key

If you have multiple SSH keys generated for different purposes (one for GitHub, one for server administration, etc...) you can specify which private key to use via config.

In ~/.ssh/config you may have the following:

host github.com
 HostName github.com
 IdentityFile ~/.ssh/id_rsa.github
 User <your PC user name (not GitHub user name)>

host digitalocean
  HostName <your server IP>
  IdentityFile ~/.ssh/id_rsa.digitalocean
  User <your server user name>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment