112 words
1 minutes
πŸ” How to Generate Your Own SSH Key Pair
2025-05-23

πŸ“¦ Generate SSH Key Pair#

Open your terminal and run:

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

Or for RSA (older systems):#

ssh-keygen -t rsa -b 4096 -C "[email protected]"

Then follow these steps:

  1. Location prompt – Press Enter to save to default: ~/.ssh/id_ed25519 or id_rsa
  2. Passphrase (optional) – Add a secure passphrase or press Enter to skip

πŸ“‚ Your Key Files#

  • Private Key: ~/.ssh/id_ed25519 (keep this secure)
  • Public Key: ~/.ssh/id_ed25519.pub (you share this with servers)

πŸš€ Add SSH Key to Your Agent#

eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519

πŸ› οΈ Add Public Key to GitHub/GitLab#

  1. Copy the key:

    cat ~/.ssh/id_ed25519.pub
  2. Go to your platform’s SSH Keys settings and paste it there

πŸ” Test Your Connection#

ssh -T [email protected]
NOTE

Replace github.com with your service provider (e.g., gitlab.com, your server IP, etc.)


πŸ” How to Generate Your Own SSH Key Pair
https://www.itsnooblk.com/posts/how-generate-ssh-keypair/
Author
Lahiru Sandaruwan Liyanage
Published at
2025-05-23
License
MIT License