-
Create config file in ~/.ssh
-
Fill out the config using the example and explanation below:
-
Host github.com
- HostName github.com
- User git
- IdentityFile ~/.ssh/github
-
Host: Defines for which host or hosts the configuration section applies. The section ends with a new Host section or the end of the file. A single * as a pattern can be used to provide global defaults for all hosts.
- Hostname: Specifies the real host name to log into. Numeric IP addresses are also permitted.
- User: Defines the username for the SSH connection.
- IdentityFile: Specifies a file from which the user’s DSA, ECDSA or DSA authentication identity is read. The default is ~/.ssh/identity for protocol version 1, and ~/.ssh/id_dsa, ~/.ssh/id_ecdsa and ~/.ssh/id_rsa for protocol version 2.
-
-
From the ~/.ssh file run the command ssh-keygen -t rsa -C "name of key" -f "name of key" In the above code example the below are references to each flag and their meaning:
- t: Selects the key type, in the above example we use the rsa type
- C: Creates a comment on the ssh key file. I use this as a duplicate of the key name
- f: keyname
-
Run ssh-add ~/.ssh/hostname to successfully add the ssh key
-
Test the command(with github auth): ssh git@github.com
Last active
July 8, 2019 14:45
-
-
Save bahull/8f9ad44bf513d5a230a5c61e1e4cb99a to your computer and use it in GitHub Desktop.
Multi-SSH Key Configuration
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment