mbrenig
mbrenig

Reputation: 577

Windows 7. Git public key configuration

I have followed the instructions here: http://help.github.com/win-set-up-git/ to set up git on my windows 7 machine.

I can use "git bash" and run commands. I am prompted for my key's pass phrase and can successfully connect. E.g.:

$git push -u origin master
Enter passphrase for key '/c/Users/mbj/.ssh/id_rsa':
Everything up-to-date

Also this:

$ ssh -T git@github.com
Enter passphrase for key '/c/Users/mbj/.ssh/id_rsa':
Hi markbrenigjones! You've successfully authenticated, but GitHub does not provi
de shell access.

$ which ssh
/bin/ssh

However, when I open a regular windows command prompt and run the same command, I get this:

C:\util\meta_vimrc>git push
Permission denied (publickey).
fatal: The remote end hung up unexpectedly

Also this:

C:\util\meta_vimrc>ssh -T git@github.com
Permission denied (publickey).

C:\util\meta_vimrc>which ssh
C:\Program Files (x86)\Git\bin\ssh.exe

How do I get this working from the non "git bash" prompt?

Upvotes: 3

Views: 9891

Answers (2)

Kaz
Kaz

Reputation: 58637

Perhaps the program has no idea where your HOME directory is when running from the Windows cmd.exe interpreter. For this to work, the ssh configuration directory with your key has to be found, namely /c/Users/mbj/.ssh.

Set this by running:

set HOME=C:\Users\mbj\

Upvotes: 4

sblom
sblom

Reputation: 27363

What works for me is to run PuTTY's Pageant.exe and add your private key to it. Then plink.exe knows where to find the key no matter what.

Upvotes: -1

Related Questions