478

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. – Jarrod Roberson Nov 5 '10 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 – Dan McClain Nov 5 '10 at 17:20
  • yes all the files and directories are the correct owners and permissions – Jarrod Roberson Nov 6 '10 at 7:21

31 Answers 31

0

Using Windows 10, I could not get the pageant generated SSH key working (at least for Git on the command line, using SourceTree I didn't have an issue) when running:

git push origin master

So my solution:

  1. I opened 'Git Bash'
  2. Ran

    ssh-keygen
    
  3. Confirmed keys now exist

    ls ~/.ssh
    
  4. Opened id_rsa.pub in Notepad++, selected all the contents

  5. Added a new key in Bitbucket, https://bitbucket.org/account/user/myusername/ssh-keys/

  6. Labelled and pasted contents into the key field --> Add Key

After that, command line Git worked. It appears that it wants the old PEM format, because if I try to import this key into pageant it says as much.

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.