This post shows students and new users the steps to generate or create SSH keys in Windows 11 or 10. If you want to remotely connect to an SSH server using key authentication or use GitHub to manage your code, you will need an SSH key.
On Ubuntu Linux and other Unix-like systems, generating and managing the SSH key and key authentication is pretty easy and straightforward.
Below is a post that shows you how to create an SSH key on Ubuntu Linux that might work on other Linux distributions as well.
How to create an SSH key for key authentication
When using a Windows machine, the steps above to create an SSH key may be a little different. Windows 11 comes with a built-in OpenSSH package and commands that can be used to generate and manage keys from the command prompt, Windows terminal, or PowerShell.
If you are going to use the command line, you should definitely use the Windows Terminal which is installed by default in Windows 11. The Windows Terminal provides a better experience and features, and you can run the Command Prompt, PowerShell, and the Windows Subsystem. Windows for Linux all in one window.
How to create SSH keys in Windows 11
As mentioned above, you can create or generate SSH keys in Windows 11. If you want to use SSH key authentication or use SSH key-based authentication, you will need to create an SSH key pair.
The steps below show you how to do it in Windows 11
In Windows, to generate an SSH key, just run the following commands and press Enter.
The above command will automatically create and generate a 2048 bit RSA key.
GitHub recommends generating an SSH key with the Ed25519 algorithm.
ssh-keygen -t ed25519 -C "email@example.com"
When you run the above commands, you will be prompted for the following lines asking to enter a location to save the file.
Generating public/private ed25519 key pair. Enter file in which to save the key (C:UsersRichard/.ssh/id_ed25519):
If you use the default values, it will save your keys in C: User .ssh
Next, you will be asked to enter a passphrase. Usually you leave this empty and hit Enter. However, you can protect your SSH key by entering a passphrase so that you will be prompted for the passphrase each time you want to use the key to authenticate.
Created directory 'C:UsersRichard/.ssh'. Enter passphrase (empty for no passphrase):
After that, you should see a screen similar to the one below. Your SSH key pair should be created and ready to use.
Generating public/private ed25519 key pair. Enter file in which to save the key (C:UsersRichard/.ssh/id_ed25519): Created directory 'C:UsersRichard/.ssh'. Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in C:UsersRichard/.ssh/id_ed25519. Your public key has been saved in C:UsersRichard/.ssh/id_ed25519.pub. The key fingerprint is: SHA256:fXTi96BC8pHrLtqyBOrtKBeWvYSMigOKt9U898rd1Jo firstname.lastname@example.org The key's randomart image is: +--[ED25519 256]--+ | | | | | o . | | . + o | | o +. S = o o | |o *.o+ + + + o | |*..o..= . + o . .| |B.o+...=.+ + o | | =+oo o+++= E | +----[SHA256]-----+
You should do that!
In this tutorial we have seen how to generate an SSH key in Windows 11. If you find any errors above or have something to add, use the comment form below.