Created
July 3, 2021 17:50
-
-
Save slxny/6e676df862171d363b1087a2743c026f to your computer and use it in GitHub Desktop.
Adding SSH keys for Git
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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