'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条回答
smile是对你的礼貌
2楼-- · 2020-01-27 03:04

If you have installed Git, and is installed at C:\Program Files, follow as below

  1. Go to "C:\Program Files\Git"
  2. Run git-bash.exe, this opens a new window
  3. In the new bash window, run "ssh-keygen -t rsa -C""
  4. It prompts for file in which to save key, dont input any value - just press enter
  5. Same for passphrase (twice), just press enter
  6. id_rsa and id_rsa.pub will be generated in your home folder under .ssh
查看更多
淡お忘
3楼-- · 2020-01-27 03:04

You probably should check this. Windows doesn't have that command built in.

查看更多
Juvenile、少年°
4楼-- · 2020-01-27 03:08

I followed below in windows (With Git for Windows installed)

  1. Run "Git Gui" (Start --> Git --> Git Gui)
  2. Click Help and then Show SSH Key
  3. Click Generate Key if you do not have one already

Note:- this creates the key files under your personal profile folder C:\Users\YourUserID\.ssh\

enter image description here

查看更多
霸刀☆藐视天下
5楼-- · 2020-01-27 03:11

don't do anything just type in your command prompt

C:\> sh

then you got like this

sh-4.4$ 
# type here 
ssh-4.4$ ssh-keygen -t rsa -b 4096 -C "example@example.com"

this should must work.

查看更多
该账号已被封号
6楼-- · 2020-01-27 03:18

I just had this issue and thought I'd share what I thought was an easier way around this.

Open git-bash and run the same command with the addition of -C since you're commenting in your email address: ssh-keygen -t rsa -C "email@youremail.com" command. That's it.

git-bash should have been installed when you installed git. If you can't find it you can check C:\Program Files\Git\Git Bash

The first time I did this it failed to create the .ssh folder for me so I had to open a standard Command Prompt and mkdir C:\Users\yourusername\.ssh

查看更多
太酷不给撩
7楼-- · 2020-01-27 03:21

I found an easy solution to fix this :

In the command prompt, go to your git\bin directory, and then execute your commands from here

查看更多
登录 后发表回答