My Git setup runs fine on Linux, but when I try to set things up under Windows (using Git for Windows and TortoiseGit), I don't know where to put my private SSH key (or, better still, how to tell ssh where it's located). I'm using the standard ssh.exe option during installation of Git for Windows. The setup runs fine if I allow password authentication (in lieu of RSA) on the server.

  • I have the same problem, I can ssh into my dev box using a public key as "root" using the "Git Bash" program that is installed with "Git For Windows" but I can't log in as "git" with my key even though I have copied my "authorized_keys" file from my "root" to my "git" user and set the owners and permissions correctly. Why can't I login as "git" when "root" works with the exact same "authorized_keys" file. Instead for "git" it passes up all the private keys, which are the exact same that work with "root" and asks for a password. This is a Centos 5.5 server by the way.
    – user35861
    Nov 5, 2010 at 1:36
  • @fuzzy lollipop: Do you have the right permissions on your git user's authorized_keys file? It should be chmod 600, and should be owned by the git user. If it's owned by the root user, it wont work Nov 5, 2010 at 17:20
  • yes all the files and directories are the correct owners and permissions
    – user35861
    Nov 6, 2010 at 7:21

32 Answers 32


If using Git for Windows, once the SSH keys have been generated, you must add your SSH key to ssh-agent.

See Generating a new SSH key and adding it to the ssh-agent.

eval $(ssh-agent -s)

// Tell where the keys are located

ssh-add ~/.ssh/id_rsa
  • Welcome to Server Fault. This question already has a widely accepted answer accepted several years ago. Keep looking for newer questions or those that can be significantly improved. Sep 13, 2017 at 19:21
  • 1
    the widely accepted answer did not work for me whereas this one did. I believe it might help someone to know the key must be added to the ssh agent and it can be done with 2lines of instructions
    – Matoeil
    Sep 14, 2017 at 10:05

Windows --> Preferences --> ssh2--> general--> load the private key . The pair's public key should have been uploaded to the git and voila things should work.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.