Skip to content

Instantly share code, notes, and snippets.

@cgranier
Created May 10, 2020 00:49
Show Gist options
  • Save cgranier/79e10a7bb537c7ad6ef0e7dfc5a55fdd to your computer and use it in GitHub Desktop.
Save cgranier/79e10a7bb537c7ad6ef0e7dfc5a55fdd to your computer and use it in GitHub Desktop.

If you want to use a different ssh key file to log into github, follow these instructions:

From: https://stackoverflow.com/questions/4565700/how-to-specify-the-private-ssh-key-to-use-when-executing-shell-command-on-git

Put this in your ~/.ssh/config file:

Host github.com
    IdentityFile ~/.ssh/id_rsa.github
    IdentitiesOnly yes # see NOTES below

Then chmod 600 the config file.

NOTES: The IdentitiesOnly yes is required to prevent the SSH default behavior of sending the identity file matching the default filename for each protocol. If you have a file named ~/.ssh/id_rsa that will get tried BEFORE your ~/.ssh/id_rsa.github without this option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment