Key takeaways

  • Run ssh-keygen -t ed25519 -C "you@example.com" to generate an SSH key; GitHub's docs give the same command for macOS, Linux and Windows.
  • Released OpenSSH, up to 10.6p2 from November 5, 2026, still generates Ed25519 keys by default.
  • A December 5, 2026 commit switches the default in OpenSSH's development code to ECDSA P-384, with no reason given and no release yet.

To generate an SSH key, open a terminal and run ssh-keygen -t ed25519 -C "you@example.com", press Enter to accept the file location, and type a passphrase. That is how GitHub's docs do it on macOS, Linux and Windows. It produces two files: a private key that stays on your computer and a .pub file you hand out.

The question of which key type to pick got less settled this week. On December 5, 2026, the OpenSSH developers changed the default in their development code from Ed25519 to ECDSA on the NIST P-384 curve. No release has that change yet (our report on the commit has the details). The steps below work with either type, and the section after them covers what the change does and doesn't mean.

The Linux commands here were run on Ubuntu 24.04 with OpenSSH 9.6p1. The macOS and Windows steps come from GitHub's and Microsoft's docs and were not run.

Check your OpenSSH version and the keys you already have

ssh -V prints the version, on all three systems:

ssh -V

On the test machine it printed OpenSSH_9.6p1 Ubuntu-3ubuntu13.20, OpenSSL 3.0.13 30 Jan 2024. The newest release listed in the OpenSSH release notes is 10.6p2, from November 5, 2026.

Then look for existing keys. GitHub's docs use:

ls -al ~/.ssh

Public keys end in .pub. The default names are id_ed25519.pub, id_ecdsa.pub and id_rsa.pub, so the file name usually tells you the type. To be sure, ask ssh-keygen for the fingerprint:

ssh-keygen -l -f ~/.ssh/id_ed25519.pub

The output is one line: the key size in bits, the fingerprint, the comment and the type in brackets. A test key gave 256 SHA256:hVUh... you@example.com (ED25519). An ECDSA P-384 key shows 384 ... (ECDSA) and a 4096-bit RSA key shows 4096 ... (RSA). If you find a pair you want to keep using, skip to the agent step.

Generate a new SSH key with ssh-keygen

GitHub's recommended command is the same on macOS, Linux and Windows:

ssh-keygen -t ed25519 -C "you@example.com"

-t sets the key type and -C adds a comment, which is only a label. ssh-keygen then asks where to save the key. Press Enter for the default, ~/.ssh/id_ed25519 on macOS and Linux and C:\Users\YOU\.ssh\id_ed25519 on Windows. If a key with that name exists, it asks before overwriting. Say no and pass a different name with -f unless you mean to replace it.

Next it asks for a passphrase. The passphrase encrypts the private key on disk, so a stolen laptop or backup doesn't hand over your logins. Microsoft's docs advise against leaving it empty.

For a system too old for Ed25519, GitHub's fallback is RSA:

ssh-keygen -t rsa -b 4096 -C "you@example.com"

To get the type OpenSSH's development code now generates by default, ask for it by name:

ssh-keygen -t ecdsa -b 384 -C "you@example.com"

That saves to ~/.ssh/id_ecdsa. The ssh-keygen manual says -b accepts 256, 384 or 521 for ECDSA and nothing else. Microsoft's OpenSSH docs use ssh-keygen -t ecdsa as their example, which on the released versions gives a 256-bit key.

One practical difference showed up in testing. The Ed25519 public key was 97 bytes with its comment, the ECDSA P-384 one 213 bytes and the RSA 4096 one 733 bytes. All three are still a single line to paste.

If you change your mind about the passphrase later, ssh-keygen -p -f ~/.ssh/id_ed25519 replaces it without making a new key.

Add the key to the ssh-agent

The agent holds your unlocked key in memory so you type the passphrase once, not on every connection. Swap in your own file name if it isn't id_ed25519.

On Linux:

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

On macOS, start the agent the same way, then use Apple's own ssh-add so the passphrase goes into the keychain:

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

GitHub also has you put these lines in ~/.ssh/config, so the key loads by itself after a restart:

Host github.com
  AddKeysToAgent yes
  UseKeychain yes
  IdentityFile ~/.ssh/id_ed25519

Leave out UseKeychain and --apple-use-keychain if the key has no passphrase. On macOS older than 12.0 (Monterey), GitHub says to use -K in place of --apple-use-keychain.

On Windows the agent is a service that is off by default. In PowerShell opened as administrator:

Get-Service -Name ssh-agent | Set-Service -StartupType Manual
Start-Service ssh-agent

Then, in a normal PowerShell window:

ssh-add $env:USERPROFILE\.ssh\id_ed25519

Microsoft's version of the first command sets the startup type to Automatic, which starts the agent at every boot. If Git keeps asking for the passphrase anyway, GitHub's docs say Git for Windows is probably using its own bundled ssh.exe, and give the fix: git config --global core.sshCommand "C:/Windows/System32/OpenSSH/ssh.exe".

ssh-add -l lists what the agent is holding, on any system.

Put the public key on a server

A server lets you in when your public key is a line in ~/.ssh/authorized_keys in your account there. From macOS or Linux, ssh-copy-id does that for you:

ssh-copy-id -i ~/.ssh/id_ed25519.pub user@server.example.com

It logs in with your password one last time and appends the key, creating the file and directory if they are missing, according to its manual page. This command was not run against a real server for this guide.

Microsoft's docs for Windows don't use ssh-copy-id. They append the key over SSH with a short PowerShell snippet, and they note a catch for Windows servers: for an account in the Administrators group, the key goes in C:\ProgramData\ssh\administrators_authorized_keys, not in the user's own .ssh folder, and that file must be readable only by Administrators and SYSTEM. Without a helper, the manual route works everywhere: log in with your password and paste the contents of the .pub file as one line into authorized_keys.

Only ever copy the .pub file. The file without the extension is the private key.

Add the SSH key to GitHub

Copy the public key. On macOS, pbcopy < ~/.ssh/id_ed25519.pub. On Windows, clip < ~/.ssh/id_ed25519.pub, or cat ~/.ssh/id_ed25519.pub | clip in PowerShell. On Linux, print it with cat ~/.ssh/id_ed25519.pub and copy the line.

Then, following GitHub's steps:

  1. Click your profile picture, then Settings.
  2. Under Access in the sidebar, click SSH and GPG keys.
  3. Click New SSH key, give it a title such as "work laptop", and leave the type as authentication.
  4. Paste the key into the Key field and click Add SSH key.

With the GitHub CLI it is one line: gh ssh-key add ~/.ssh/id_ed25519.pub --title "work laptop".

Test it with ssh -T git@github.com. A working key gets "Hi USERNAME! You've successfully authenticated, but GitHub does not provide shell access."

Which key type: what OpenSSH changed and what it didn't

Released OpenSSH still makes Ed25519 keys when you give no -t. Version 9.6 did in testing, the online manual still said "will generate an Ed25519 key" on December 5, and Microsoft's docs say the same of Windows.

The development code now differs. The commit titled "switch default key type generated to ECDSA NISTP384" edits two lines of ssh-keygen.c: the default type goes from ed25519 to ecdsa, and the default ECDSA size from 256 bits to 384. The file header dates the edit December 3 in OpenBSD's own tree, and it reached the portable repository on December 5. Its message gives no reason. A companion commit the same day reorders which signature algorithms OpenSSH prefers, and its message says it is to "prefer ML-DSA 44/ed25519 hybrid followed by ECDSA NISTP384". The hybrid is a post-quantum key type, mldsa44-ed25519, that the release notes say was enabled in OpenSSH 10.6p1, released October 6, 2026. OpenSSH 9.6 rejects it with "unknown key type".

Nothing in these commits removes or disables Ed25519 or RSA keys, and none of it is in the release notes yet. It is a change to what a bare ssh-keygen will produce in some future version.

The commits landed in a week of cryptography warnings, though they cite none of them. Also on December 5, Anthropic and OpenAI said in a joint statement that their researchers had found weaknesses "in some of the cryptography that protects the internet" and urged a faster move to post-quantum algorithms. The statement names no algorithm, so it does not say any SSH key type is affected; our report on the statement has the details. Earlier in the week, Google said Chrome will stop trusting CA keys that use ECDSA P-256 on March 15, 2027. That is about website certificates and a different curve from the P-384 OpenSSH picked, and Google's post doesn't mention SSH. Our article on the Chrome deadline covers it.

So as of December 5, the sources disagree in a small way. GitHub's docs recommend Ed25519, shipping OpenSSH defaults to it, and OpenSSH's unreleased code defaults to ECDSA P-384 and prefers a post-quantum hybrid above both. How the two types differ is covered in ECDSA vs Ed25519. The thing to watch is the next entry in the OpenSSH release notes, which is where the developers normally explain a change like this one.

Frequently asked questions

How do I check my OpenSSH version?

Run ssh -V in a terminal on macOS or Linux, or in PowerShell on Windows. It prints one line such as OpenSSH_9.6p1. The newest release in the OpenSSH release notes is 10.6p2, from November 5, 2026.

What is the best SSH key type in 2026?

The sources differ as of December 5, 2026. GitHub's docs recommend Ed25519 and released OpenSSH generates it by default. OpenSSH's unreleased development code now defaults to ECDSA P-384 and prefers the post-quantum hybrid mldsa44-ed25519 above both, without stating a reason.

How do I check which SSH key type I have?

Run ssh-keygen -l -f ~/.ssh/id_ed25519.pub with your own file name. The output ends with the type in brackets, such as (ED25519), (ECDSA) or (RSA), and starts with the key size in bits.

Do I need to replace my Ed25519 SSH key now?

Nothing OpenSSH has published says so. The December 5 commits change which type a bare ssh-keygen creates in a future version and do not remove or disable Ed25519 keys. The Anthropic and OpenAI statement on cryptography weaknesses names no algorithm.

Sources

  1. ssh-keygen(1) manual pageOpenBSD
  2. upstream: switch default key type generated to ECDSA NISTP384OpenSSH
  3. upstream: change the default signature algorithm preference orderOpenSSH
  4. upstream: Sync man page, default key type was changed from ed25519 to ecdsaOpenSSH
  5. OpenSSH release notesOpenSSH
  6. Generating a new SSH key and adding it to the ssh-agentGitHub
  7. Checking for existing SSH keysGitHub
  8. Adding a new SSH key to your GitHub accountGitHub
  9. Testing your SSH connectionGitHub
  10. Key-based authentication in OpenSSH for WindowsMicrosoft
  11. ssh(1) manual pageOpenBSD
  12. ssh-copy-id(1) manual pageUbuntu
  13. Joint statement from Anthropic and OpenAI on recent advances in cryptographyAnthropic
  14. Keeping HTTPS Connections Safe in ChromeGoogle

Add ClaudeGPT Si as a preferred source on Google