Enhance Github security by connecting using Secure Shell Protocol (SSH)
- Published on
- Published on
- /3 mins read/---
CAUTION
This instruction is for MacOS devices only.
GitHub's SSH key fingerprints
When try to clone a Github repo using SSH
, you might get an error like this:
This is because you're missing the public key fingerprints, the key can be used to validate a connection to Github remote server.
You can add the following ssh key entries to your ~/.ssh/known_hosts
file to avoid manually verifying GitHub hosts.
Paste the following content to the file:
It's the default SSH key fingerprints from Github's documentation.
Generating SSH key
Next you might get an error like this when trying to clone a repo:
This is because you're missing the SSH key, you can generate a new one by following the steps below:
- Open your terminal and run the following command:
The system might ask you to enter a passphrase like this:
Type a simple one and don't forget it since you'll need it later.
- Start the SSH agent:
Then create the ~/.ssh/config
file (or update the existing one):
Add the following content to the file:
Then add your SSH private key to the ssh-agent and store your passphrase in the keychain:
- Add the new SSH key to your GitHub account:
Open your Github account and navigate to your SSH and GPG keys page settings, then create a new SSH key.
Now you're good to go! Try to clone a Github repo using SSH to make sure everything is working.
Happy securing!