How-to configure git to use ssh keys on windows

  • Update git to the last version
  • Create a key for your github account
ssh-keygen -t rsa -C "your-email-address"

That command will print

Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/your_username/.ssh/id_rsa):

Enter the full path you want to save your key in and be sure the folder exists or you’ll get an error. For example:


This will generate two files: id_rsa_villagra and

  • Add the pub’s file contents in your github account => settings => ssh and gpg keys.
  • Navigate to the repository you want to connect via ssh ahd type
git config core.sshCommand "ssh -i c:/Users/villagra/.ssh/id_rsa_villagra"
git config "myusername"
git config ""

It should looks like this one

	repositoryformatversion = 0
	filemode = false
	bare = false
	logallrefupdates = true
	symlinks = false
	ignorecase = true
	sshCommand = ssh -i c:/Users/villagra/.ssh/id_rsa_villagra
[remote "origin"]
	url =
	fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
	remote = origin
	merge = refs/heads/master
	name = myusername
	email =

And done! Your repository now uses keys instead of credentials authentication.