'ssh-keygen' is not recognized as an inter

2020-01-27 02:44发布

I run git push -u origin master

It tells me that "Permission denied (public key) fatal: The remote end hung up unexpectedly"

Then I looked up on the internet and found that I had to generate an ssh key for my account on GitHub. However, upon doing so, when I tried to do ssh-keygen -t rsa "email@youremail.com" it simply said ssh-keygen is not recognized. I tried doing mkdir C:\ssh but that didn't work. If it helps I'm using Ruby Rails and I'm on a Windows computer. Could anyone help me?

14条回答
forever°为你锁心
2楼-- · 2020-01-27 02:59

for those who does not choose BASH HERE option. type sh in cmd then they should have ssh-keygen.exe accessible

查看更多
Fickle 薄情
3楼-- · 2020-01-27 03:00

No need to add anything to environmental variables! Just open up git bash and perform command the ssh-keygen in there.

Link to download git bash here

查看更多
Luminary・发光体
4楼-- · 2020-01-27 03:00

Just go to heroku.bat and add:

@SET PATH="D:\Program Files (x86)\Git\bin";%PATH% after @SET PATH=%HEROKU_RUBY%;%PATH%

in my case it's in D:\Program Files (x86)\Git\bin, change it to the path you've installed Git to. (i just left it with my path so it will be clearer on how to write this)

查看更多
够拽才男人
5楼-- · 2020-01-27 03:01

2012:
ssh-keygen.exe is part of msysgit:

 C:\path\to\msysgit1.7.11\bin\ssh-keygen.exe

if your %PATH% includes C:\path\to\msysgit1.7.11\bin\, you will have ssh-keygen.


Update 2015:
ssh-keygen.exe is part of Git For Windows, whose releases include PortableGit-2.4.3.1-2nd-release-candidate-64-bit.7z

c:\path\to\PortableGit-2.4.3.1-2nd-release-candidate-64-bit\usr\bin\ssh-keygen.exe

That means the %PATH% must include c:\path\to\PortableGit-2.4.3.1-2nd-release-candidate-64-bit\usr\bin (without the ssh-keygen.exe)

As I explained before, Git for Windows will soon phase out msysgit.
I detailed in "Why is it that if you download Git 2.0 from the net, you always get a 1.9.4 installer package?" how this new version is based on the more recent msys2 project.

查看更多
Viruses.
6楼-- · 2020-01-27 03:01

For windows you can add this:

SET PATH="C:\Program Files\Git\usr\bin";%PATH%
查看更多
淡お忘
7楼-- · 2020-01-27 03:02

I got it fixed by just adding ssh-keygen to my environment variables.

查看更多
登录 后发表回答