This post explains how to setup SSH Authentication to GitHub in Windows 10. With SSH keys, you can connect to GitHub without supplying your username and personal access token at each visit.
Generate a new SSH key
Open Git Bash and run below command.
ssh-keygen -t ed25519 -C "replace_with_email_id"
Press Enter on "Enter a file in which to save the key" prompt. This accepts the default file location.
Enter a file in which to save the key (/c/Users/you/.ssh/id_algorithm):[Press enter]
Type secure passphrase for below prompts.
Enter passphrase (empty for no passphrase): [Type a passphrase]
Enter same passphrase again: [Type passphrase again]
Add SSH key to the ssh-agent
Allow ssh-agent to be manually started, by default the ssh-agent service is disabled in Windows 10.
Powershell Prompt with Admin Privileges and run below commands.
Start the ssh-agent service.
Get-Service ssh-agent | Set-Service -StartupType Manual
Check status of ssh-agent service.
Navigate to .ssh directory.
Load key files into ssh-agent.
Add new SSH key to GitHub Account
Open Git Bash and navigate to .ssh directory.
Copy SSH public key(output of below command)
Login to GitHub Account and in the upper-right corner of any page, click on profile photo, then click Settings.
In the user settings sidebar, click SSH and GPG keys.
Click New SSH key
Provide suitable title and click on Add SSH Key.
Test SSH Connection
Open Git Bash and run below command you should output similar to as shown below.
ssh -T firstname.lastname@example.org
Hi username! You've successfully authenticated, but GitHub does not provide shell access.