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

标签 bash git ssh rsa

它可以与 Eclipse 默认的 git 扩展一起正常工作,我可以使用它进行每一个操作,我什至可以生成 RSA key 。

但是当我使用 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 key 并尝试生成新的 RSA key 对及其启动,然后在完成前退出。
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 key ,但出现以下错误
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 私有(private) SSH key ,而不是 OPENSSH key 。
见“Jenkins: what is the correct format for private key in Credentials

采用:

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

然后再试一次你的 git push,从一个简单的 CMD(不需要 bash),使用 simplified PATH :
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%

关于bash - Git Bash - ssh-keygen 不工作(在生成 RSA key 对之前退出),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54594983/

相关文章:

Git pull 失败,得到 "The remote end hung up unexpectedly",Windows XP Jenkins slave

bash - 如何执行shell脚本?

git - 从本地 master 推送到远程非 master 分支

GIT:如何在维护大量 fork 的同时避免重复提交?

git - git svn 与 git 子树兼容吗?

linux - shell脚本中sudo over ssh中的多个命令

具有非标准端口的 GitLab 远程存储库

linux - 从我的环境中删除错误的路径

multithreading - 如何使用 GNU Parallel 编写多核排序

linux - 如何使用 Bash 读取特定行和特定字段?