使用Git生成SSH密钥时出错:"没有这样的文件"

Kon*_*rad 11 git

当我尝试生成SSH密钥时,我不断遇到同样的错误:

Generating public/private rsa key pair.
Enter file in which to save the key (/home/konrad/.ssh/id_rsa):
Run Code Online (Sandbox Code Playgroud)

在这里我按回车键.

Could not create directory '/home/konrad/.ssh'
Run Code Online (Sandbox Code Playgroud)

然后我输入我的密码.

open /home/konrad/.ssh/id_rsa failed: No such file or directory.
Saving the key failed: /home/konrad/.ssh/id_rsa.
Run Code Online (Sandbox Code Playgroud)

我曾尝试多次重新安装Git,但这没有帮助.我想可能是因为C:/ Users/Konrad应该是默认目录,而不是/ home.有什么建议?

Von*_*onC 9

在msysgit上,首先需要设置用户环境变量HOME(在Windows中默认不设置).

HOME可以设置为您想要的任何目录,您只需要确保您有权在其中写入(并且该目录存在且其.ssh下也存在).