0

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?

2 Answers2

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.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
0

Try using command -> ssh-keygen -o This worked for me. Please refer to the following page for details, under the Git for Windows section.

Link: https://git-scm.com/book/en/v2/Git-on-the-Server-Generating-Your-SSH-Public-Key

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jun 28 '23 at 04:45
  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - [From Review](/review/late-answers/34601599) – Koedlt Jul 02 '23 at 05:33