Skip to main content
SSH keys provide a secure way to authenticate with GitHub without entering your password each time.
1

Generate SSH key

Generate a new SSH key pair using the Ed25519 algorithm:
ssh-keygen -t ed25519 -C "[email protected]"
When prompted:
  • Press Enter to accept the default file location
  • Enter a secure passphrase (recommended) or press Enter for no passphrase
2

Start ssh-agent

Start the SSH agent in the background:
eval "$(ssh-agent -s)"
This command starts the SSH agent and adds it to your current session.
3

Add SSH private key to agent

Add your private key to the SSH agent:
ssh-add ~/.ssh/id_ed25519
If you set a passphrase, you’ll be prompted to enter it.
4

Copy public key to clipboard

Copy your public key to the clipboard for easy pasting:
xclip -sel clip < ~/.ssh/id_ed25519.pub
If xclip is not installed, you can install it with sudo apt install xclip.
5

Add key to GitHub

  1. Go to GitHub.com and sign in
  2. Click your profile picture → Settings
  3. Click “SSH and GPG keys” in the sidebar
  4. Click “New SSH key”
  5. Give it a descriptive title
  6. Paste your public key in the “Key” field
  7. Click “Add SSH key”
6

Test the connection

Test your SSH connection to GitHub:
You should see a message like “Hi username! You’ve successfully authenticated…”

Next Steps

Now you can:
  • Clone repositories using SSH URLs
  • Push and pull without entering passwords
  • Use SSH for secure Git operations

Build docs developers (and LLMs) love