I'm trying to generate SSH keys for Git on Windows (I just installed 2.18.0), but it's not finding something called ssh_askpass:
d:\src\py\>ssh-keygen -b 4096 -C [email protected]
Generating public/private rsa key pair.
Enter file in which to save the key (/d//.ssh/id_rsa): D:\.ssh\id_rsa_new
ssh_askpass: exec(/usr/lib/ssh/ssh-askpass): No such file or directory
ssh_askpass: exec(/usr/lib/ssh/ssh-askpass): No such file or directory
.
.pub.
The ssh-keygen binary is the one that comes with git, in C:\Program Files\Git\usr\bin, but that directory does not have a ssh_askpass file.
Where can I get this 'ssh_askpass' ? What is the consequence of not finding it ?
Answering my own question, for the benefit of others who might stumble onto this, now that I actually understand what was going: this command was typed inside an emacs subshell, which does not have the full terminal capabilities (it's considered a "dumb" terminal).
Then ssh-keygen considers that it is not running inside a terminal, so it can't read the passphrase, and it tries to run an X Window program instead, and fails because this is Windows.
The solution is to run ssh-keygen (or ssh-add) inside Git Bash, or in the Windows command line tool, where it will be able to prompt for the passphrase, and work as expected.
As in this issue, check if you have an environment variable DISPLAY=localhost:0.0
was set.
If so, unset it with:
set DISPLAY=
Then try again your ssh-keygen
command.
Make sure also, for testing, to try and generate a key without passphrase:
ssh-keygen -t rsa -P "" -b 4096 -C [email protected]
Finally, check your %PATH%
and make sure ssh-keygen
called is the one you are thinking about (from Git installation)
where ssh-keygen
Sometimes, it can be overshadowed by one from Cygwin for instance.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With