Generate an SSH key and add it to the agent

Bash

Ed25519 rather than RSA: shorter, faster, and no key-size decision to get wrong.

ssh-keygen -t ed25519 -C 'you@example.com' -f ~/.ssh/id_ed25519
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519
cat ~/.ssh/id_ed25519.pub

More in Security

Random picks