-
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
.pubfile 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>
You can opt to store your ssh keys with 1Password. See 1Password - Import an SSH Key
Then, instead of OpenSSH Authentication Agent which loads an SSH key from disk, you can use 1Password SSH Agent to load the key directly from 1Password. See Turn on the 1Password SSH agent
π‘ Tip
You can use the SSH agent config file to control which SSH keys from your vaults are used and in what order they're checked.
-
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?