Set up an SSH key for GitHub

Push and pull without typing a password. Generate a key, add it to GitHub, and test it.

4 min5 stepsmacOS · Linux · Windows

  1. Generate a key

    Press Enter to accept the default file, then choose a passphrase.

    ssh-keygen -t ed25519 -C ""
  2. Copy the public key

    On Windows use the PowerShell version from the SSH commands.

    pbcopy < ~/.ssh/id_ed25519.pub
  3. Add it to GitHub

    GitHub → Settings → SSH and GPG keys → New SSH key. Paste and save.

  4. Test the connection

    Type yes if asked to trust GitHub’s fingerprint.

    ssh -T git@github.com
    Hi you! You've successfully authenticated, but GitHub does not provide shell access.
  5. Switch an existing repo to SSH

    Point the remote at the SSH address.

    git remote set-url origin

More guides