git: 'ssh-keygen' is not a git command. See 'git --help'

最后都变了- 提交于 2019-12-10 12:19:31

问题


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 "your_email@example.com"

This failed with git: 'ssh-keygen' is not a git command. See 'git --help'.

Why would that be and how can I fix it?


回答1:


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

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

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

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%

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



来源:https://stackoverflow.com/questions/51914229/git-ssh-keygen-is-not-a-git-command-see-git-help

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!