I always forget to transfer my keys and never remeber the command s to generte new ones, So here are my basic instructions for generating SSH keys and setting them up with Github and a server.
Generate your keys (-C "comment" optional):
ssh-keygen -f ~/.ssh/id_rsa -b 4096 -C "my ssh keys for github"

Follow onscreen instructions, providing a passphrase and location to store the public/private key pair.

Ensure the SSH agent is started:
eval "$(ssh-agent -s)
Should return the pid of the agent e.g.:
>Agent pid 12345

Add your keys (replace id_rsa with file name of your ssh keys):
ssh-add ~/.ssh/is_rsa

Now add the public key to github. Go to:

Settings > SSH and GPG Lyes > New SSH Key

Paste in your SSH key, your good to go.

To add your public keys to a server I will be using my Raspberry Pi:

ssh-copy-id -i ~/path/to/ssh/key USER@IP_ADDRESS

Now you can log in to the remote device using your SSH keys with:


Command to remove a host from your “known_hosts” file: ssh-keygen -f "/home/ben/.ssh/known_hosts" -R ""