SSH keys allow you to make a connection to a remote machine without having to enter a password every time. The keys themselves come in pairs: a public-facing key and a private key. The private key should be treated like a password, and never shared with anyone. The public-facing key will be “installed” elsewhere, such as a code hosting system.
To create an SSH key, you will need to run a program, which will save a pair of files. The necessary software is already installed on *nix-based systems, but Windows users will need to download additional (free) software.
To generate a key pair, run the following command:
$ ssh-keygen -t rsa -b 4096 -C "
You will be prompted for the following information:
Accept the default location by pressing Return to continue.
It’s optional, but you really should have one. Make it memorable or store it in a very secure password keeper that you use regularly.
The fingerprint for your key will be printed to the screen, and the key pair will be saved to the appropriate location in ~/.ssh/.
You will now need to register this key with your system so that you can begin using it.
This is where things get a little secret agent. You need to register your keys with the local “agent” (using OS X? think “keychain,” but different). Begin the ssh-agent application and redirect it to use a Bourne shell:
$ eval "$(ssh-agent -s)"