本文介绍了git:"ssh-keygen"不是git命令.参见'git --help'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图遵循 GitHub上的指令来生成SSH密钥,这样我就可以从笔记本电脑推送到我的GitHub帐户了.我在Windows 10上使用mingw32的Git,并且在Git Bash(不是cmd)中输入了以下命令:

I was trying to follow the instructions on GitHub to generate an SSH key so I can push from my laptop to my GitHub account. I'm using Git on Windows 10 with mingw32, and I entered this command in Git Bash (not cmd):

ssh-keygen -t rsa -b 4096 -C "[email protected]"

此操作失败,并显示git: 'ssh-keygen' is not a git command. See 'git --help'.

为什么会这样,我该如何解决?

Why would that be and how can I fix it?

推荐答案

在进入git bash会话之前,请确保您的%PATH%(在CMD中) .

Make sure of your %PATH% (in a CMD) before entering your git bash session.

如果您的PATH是正确的,那么您应该会看到以下内容:

If your PATH is correct, then this is what you should see:

vonc@voncvb:/mnt/c$ which ssh-keygen
/usr/bin/ssh-keygen

要进行测试,请在CMD会话中设置简化的PATH.

For testing, set a simplified PATH in your CMD session.

set PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\
set GH=C:\Git
set PATH=%GH%\bin;%GH%\usr\bin;%GH%\mingw64\bin;%MAVEN_HOME%\bin;%PATH%

然后键入bash,进入bash shell会话.
并尝试ssh-keygen.

Then type bash, to enter a bash shell session.
And try there ssh-keygen.

这篇关于git:"ssh-keygen"不是git命令.参见'git --help'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 13:39