How to Add SSH Key to GitHub?

Open a terminal

Check for existing SSH keys: `ls -al ~/.ssh`

Generate a new SSH key: `ssh-keygen -t ed25519 -C “your_email@example.com”`

Press Enter to accept the default file location

Enter a passphrase if prompted

Start the SSH agent: `eval “$(ssh-agent -s)”`

Add your SSH private key to the SSH agent: `ssh-add ~/.ssh/id_ed25519`

Copy the SSH public key: `cat ~/.ssh/id_ed25519.pub`

Sign in to GitHub

Go to Settings

Select SSH and GPG keys

Click New SSH key

Enter a title

Paste the copied public key into the key field

Click Add SSH key

Test the connection: `ssh -T git@github.com`

Suggested for You

Trending Today