Skip to content

Instantly share code, notes, and snippets.

@slxny
Created July 3, 2021 17:50
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 slxny/6e676df862171d363b1087a2743c026f to your computer and use it in GitHub Desktop.
Save slxny/6e676df862171d363b1087a2743c026f to your computer and use it in GitHub Desktop.
Adding SSH keys for Git
// SSH config
// Enter SSH config, which is a per-user configuration file for SSH communication. Create a new file: ~/.ssh/config and open it for editing:
nano ~/.ssh/config
// Managing Custom Named SSH key
// The first thing we are going to solve using this config file is to avoid having to add custom-named SSH keys using ssh-add. Assuming your private SSH key is named ~/.ssh/id_rsa, add following to the config file:
Host github.com
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa
IdentitiesOnly yes
// Alternatively, use BASH to set the SSH key manually upon every terminal restart:
eval $(ssh-agent -s)
ssh-add /c/users/Admin/.ssh/[keyname]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment