Three quick steps to set up SSH login to GitHub in Windows
Below is a brief list of steps to perform to create and use SSH keys in Git Bash and Visual Studio Code or Community.
Generate the SSH key
Open Git Bash and run:
ssh-keygen -t rsa -b 4096 -C "<email>"
ssh-add ~/.ssh/id_rsa
The latter command failed in my case
Add the key to GitHub
Follow the instructions from https://help.github.com/en/articles/adding-a-new-ssh-key-to-your-github-account.
By the way, I’ve put together a small collection of tools I use regularly — things like time tracking, Git helpers, database utilities, and a few others that make development a bit smoother.
Check the repository’s remote
Make sure you use the git protocol in your repository. Either edit the .git/config
folder or run the command git branch -v
.
Wrong:
[remote "origin"]
url = https://github.com/<username>/<repo>.git
Correct:
[remote "origin"]
url = git@github.com:<username>/<repo>.git