Setup ED25519 SSH Key for GitHub

1. Check for Existing SSH Keys

Run:

ls -al ~/.ssh

Look for id_ed25519 or similar files.

2. Generate a New SSH Key

Run:

ssh-keygen -t ed25519 -C "[email protected]"

Press Enter to accept the default location (~/.ssh/id_ed25519) and optionally set a passphrase.

3. Add the Key to SSH Agent

Start the SSH agent:

eval "$(ssh-agent -s)"

Then add your private key:

ssh-add ~/.ssh/id_ed25519

4. Copy the SSH Public Key

Run:

cat ~/.ssh/id_ed25519.pub

Or use:

pbcopy < ~/.ssh/id_ed25519.pub    
xclip -sel clip < ~/.ssh/id_ed25519.pub    

5. Add SSH Key to GitHub

  1. Go to GitHub > Settings > SSH and GPG keys.
  2. Click New SSH key.
  3. Paste your public key into the "Key" field and click Add SSH key.

6. Test the SSH Connection

Run:

ssh -T [email protected]

You should see a success message.

Optional: Git Config

Set Git to use SSH:

git config --global user.name "Your Name"
git config --global user.email "[email protected]"

Clone a repo using SSH:

git clone [email protected]:username/repository.git

Additional: SSH Config

In ~/.ssh/config (if needed):

Host github.com
    HostName github.com
    User git
    IdentityFile ~/.ssh/id_ed25519
Return to Home