Git Bash - ssh-keygen 不工作(在生成 RSA 密钥对之前退出)



它与Eclipse默认的git扩展一起工作得很好,我可以使用它做每一个操作,我甚至可以生成RSA密钥。

但是当我使用 git bash 访问 git remote 时,我收到此错误:

The authenticity of host '[hostname]:PORT ([IP Address]:PORT)' can't be established.
RSA key fingerprint is SHA256:U...M.
Are you sure you want to continue connecting (yes/no)? fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.

然后我删除了现有的 RSA 密钥并尝试生成新的 RSA 密钥对及其开始,然后在完成之前退出。

ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/userName/.ssh/id_rsa):
userName@example MINGW64 ~/git/path (branch name):

我还尝试使用 GIT GUI 生成新的 RSA 密钥,出现以下错误

error writing "stdout": broken pipe
error writing "stdout": broken pipe
    while executing
"puts $::answer"
    (procedure "finish" line 9)
    invoked from within
"finish"
    invoked from within
".b.ok invoke"
    ("uplevel" body line 1)

提前谢谢。

如果您使用的是最新版本的 Git(2.19.2 或更高版本(,请确保生成 PEM 私有 SSH 密钥,而不是 OPENSSH 密钥。
请参阅"Jenkins:凭据中私钥的正确格式是什么">

用:

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

然后使用简化的 PATH 从简单的 CMD(不需要 bash(再次尝试您的 git 推送:

set PATH=C:WINDOWSsystem32;C:WINDOWS;C:WINDOWSSystem32Wbem;C:WINDOWSSystem32WindowsPowerShellv1.0
set GH=C:pathtogit
set PATH=%GH%bin;%GH%usrbin;%GH%mingw64bin;%PATH%

最新更新