我想为 gitlab 获取一个 SSH 密钥来上传我的项目。但是对于创建命令行不起作用的密钥

I want to get a SSH key for gitlab for uploading my project. But for creating a key that command line doesn't work

这是问题的屏幕截图:

在命令行(CMD)中:

> ssh-keygen -t rsa -C "..."
'ssh-keygen' is not recognized as an internal or external program.

如何生成ssh密钥?如何使用 ssh-keygen

考虑将 Git 用于 Windows,使用 and a portable Git (like PortableGit-2.21.0-64-bit.7z.exe),解压到任何你想要的地方。

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

在该 CMD 中(运行 作为普通用户,而不是管理员),您应该有 ssh-keygen 可用。

我的例子:

vonc@VONC D:\
> where ssh-keygen
D:\prgs\git\latest\usr\bin\ssh-keygen.exe

但是,由于 a recent openssh change,请使用:

ssh-keygen -m PEM -t rsa -P "" -f afile

您将拥有与经典 PEM 侦听器兼容的密钥。