Skip to main content

SSH Key Setup

This guide explains how to generate SSH keys and configure them for use with GitHub and remote servers.

Generate an SSH Key

# Generate a new Ed25519 SSH key
ssh-keygen -t ed25519 -C "your.email@example.com"

# When prompted for file location, press Enter for default (C:\Users\YOU\.ssh\id_ed25519)
# Optionally set a passphrase for additional security

# Start the SSH agent (if not running)
Get-Service ssh-agent | Set-Service -StartupType Automatic
Start-Service ssh-agent

# Add your key to the agent
ssh-add $env:USERPROFILE\.ssh\id_ed25519

If ssh-agent is not available, enable OpenSSH:

  1. Open Settings → Apps → Optional Features
  2. Add OpenSSH Client if not installed

Copy Your Public Key

You'll need your public key to add to GitHub or remote servers.

# Copy to clipboard
Get-Content $env:USERPROFILE\.ssh\id_ed25519.pub | Set-Clipboard

# Or display to copy manually
Get-Content $env:USERPROFILE\.ssh\id_ed25519.pub

Add Key to GitHub

Once you have your SSH key, add it to GitHub:

Multiple SSH Keys

If you need different keys for different services (e.g., work vs personal):

  1. Generate additional keys with different names:

    ssh-keygen -t ed25519 -C "personal@example.com" -f ~/.ssh/id_ed25519_personal
  2. Configure ~/.ssh/config to use the right key:

    # Work GitHub
    Host github.com
    HostName github.com
    User git
    IdentityFile ~/.ssh/id_ed25519

    # Personal GitHub
    Host github-personal
    HostName github.com
    User git
    IdentityFile ~/.ssh/id_ed25519_personal
  3. Clone using the configured host alias:

    git clone git@github-personal:username/repo.git