-
Open a terminal in the directory where you want to save your key.
-
Run this command to generate a new SSH key:
ssh-keygen -t ed25519 -C "Your Key Name"
For older systems that don't support Ed25519, use RSA instead:
ssh-keygen -t rsa -b 4096 -C "Your Key Name"
-
Follow the prompts. Once done, you'll have both a private and public key saved. Copy the contents of the
.pub
file to your VCS (Version Control System) service of choice.See below links for your service:
-
To SSH into a server using your key:
ssh -i "<PathToPrivateKeyFile>" <username>@<ServerIpAddress>
-
Open a terminal as Administrator in the directory where your key is stored.
-
Start the OpenSSH agent and set it to launch automatically:
Start-Service ssh-agent Set-Service -Name ssh-agent -StartupType Automatic
-
Add your private key to the agent:
ssh-add ./YourPrivateKey
-
Make Git explicitly use OpenSSH:
git config --global core.sshCommand C:/Windows/System32/OpenSSH/ssh.exe
π‘ Tip
Want other ways to auto-load SSH keys? Check out this helpful post: Server Fault - Does ssh autoload everything in .ssh?