How To Setup SSH Key in Linux and MacOS (Terminal)

ls ,

I always forget how to setup SSH keys to new sites so this is how you can do it in Linux.

Linux / MacOS

Press Enter twice to accept the default location and skip setting a passphrase

ssh-keygen -t ed25519 -C "your_email@example.com"

This creates

  • Private key → ~/.ssh/id_ed25519 (keep secret)
  • Public key → ~/.ssh/id_ed25519.pub (upload to server)

Copy public key

cat ~/.ssh/id_ed25519.pub