"gethostname: bad address" from ssh-keygen

Viewed 184

While generating SSH key from git bash in windows I am getting the following error

gethostname: Bad address.

I am using the following command

ssh-keygen -t rsa -b 4096 -C "<your email address>"
2 Answers

It is solved now Need to use git-cmd

I have seen this when used in parallel with Cygwin

If git-cmd works, you can use ssh-keygen directly, or type "bash", and use the same command from the bash session.

I prefer setting a custom path to make sure there is no interference between Git and any other program with, in a CMD:

set PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\
set "GH=C:\Program Files\Git"
set "PATH=%GH%\bin;%GH%\cmd;%GH%\usr\bin;%GH%\mingw64\bin;%GH%\mingw64\libexec\git-core;%PATH%"

From there, a bash or a ssh-keygen would work in that same CMD.

Related