Skip to content

SSH🔗

For more, see github guides: https://docs.github.com/en/authentication/connecting-to-github-with-ssh/about-ssh

Create SSH Key🔗

It's best to create new keys for new machines as opposed to copying an old key from one machine to another. Use a password if other people have access to your machine, otherwise feel free to leave blank.

Bash
ssh-keygen -t ed25519 -f ~/.ssh/github_key

Add Github to SSH Config🔗

To make sure this key gets used when we try to authenticate to Github, we'll add the following entry to ~/.ssh/config:

Text Only
1
2
3
Host github.com
    PreferredAuthentications publickey
    IdentityFile ~/.ssh/github_key

To do this with a terminal editor use one of the following:

Bash
1
2
3
nano ~/.ssh/config
vim ~/.ssh/config
ed ~/.ssh/config

To do this with a GUI editor, you have to make sure the file exists first:

Bash
touch ~/.ssh/config
open ~/.ssh/config

Add Public Key to Github🔗

Copy your public key to the clipboard with the following:

Bash
pbcopy < ~/.ssh/github_key.pub

Last update: June 7, 2023
Created: June 7, 2023