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

时间:2019-02-08 14:55:02

标签: bash git ssh 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)

谢谢。

1 个答案:

答案 0 :(得分:0)

如果您使用的是最新版本的Git(2.19.2或更高版本),请确保生成PEM专用SSH密钥,而不是OPENSSH密钥。
参见“ Jenkins: what is the correct format for private key in Credentials

使用:

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

然后使用simplified PATH,通过简单的CMD(无需bash)再次尝试git push:

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%
相关问题