This guide provides a basic, step-by-step tutorial for generating a standard OpenSSH key and adding it to your GitHub account for secure communication with your repositories.
Most modern operating systems come with OpenSSH pre-installed. Here’s how to check and install it if needed.
Windows 10/11:
OpenSSH is included by default. You can verify this by opening PowerShell and typing ssh -V. If it’s not found, go to Settings > Apps > Optional features, click Add a feature, and install the “OpenSSH Client”.
macOS:
OpenSSH is included by default. You can open the Terminal app and run ssh -V to see the version.
Linux (Debian/Ubuntu): OpenSSH is usually pre-installed. If not, you can install it by running:
sudo apt update && sudo apt install openssh-client
This process creates a standard ed25519 public/private key pair on your computer.
Open your terminal.
ssh-keygen -t ed25519 -C "your_email@example.com"
~/.ssh/id_ed25519).~/.ssh/ directory:
id_ed25519: Your private SSH key. Never share this file!id_ed25519.pub: Your public SSH key. This is the file you will add to GitHub.Copy your public key to the clipboard. You can display its contents in the terminal to copy it manually.
cat ~/.ssh/id_ed25519.pub
Select and copy the entire output, which starts with ssh-ed25519 and ends with your email address.
Add the key to your GitHub account:
Finally, test that your new key is working correctly.
ssh -T git@github.com
yes and press Enter.
The authenticity of host ‘github.com (IP ADDRESS)’ can’t be established. ED25519 key fingerprint is SHA256:+DiY3wvvV6TuJJhbpZisF/zLDA0zPMSvHdkr4UvCOqU. Are you sure you want to continue connecting (yes/no/[fingerprint])?
If you set a passphrase for your key in Step 2, you will be prompted to enter it now.
Hi
YourUsername! You’ve successfully authenticated, but GitHub does not provide shell access.
Congratulations! Your computer is now set up to securely communicate with GitHub using SSH.