【发布时间】:2021-10-07 03:32:29
【问题描述】:
以下是我创建和尝试添加 SSH 密钥的步骤,但我不确定我哪里出错了,非常感谢任何帮助! (我是新手,抱歉)
按照网上的说明,我首先使用以下代码生成了一个新的 shh-key:
$ ssh-keygen -t ed25519 -C "[my email]"
Generating public/private ed25519 key pair.
Enter file in which to save the key (/c/Users/Akiper/.ssh/id_ed25519):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in
Your public key has been saved in .pub
等等
然后我确保 ssh-agent 在后台运行并尝试将我生成的 shh-key 添加到 shh-agent 但我收到以下错误:
$ eval `ssh-agent -s`
Agent pid 304
$ ssh-add ~/.ssh/id_ed25519
/c/Users/Akiper/.ssh/id_ed25519: No such file to directory
正如您在第三行代码中看到的,密钥保存在以下文件中:
Enter file in which to save the key (/c/Users/Akiper/.ssh/id_ed25519):
正如您可以想象的那样,我很困惑为什么代码说它无法找到其中的关键,或者我可能错误地解释了代码。再次感谢任何帮助和建议。
谢谢。
【问题讨论】:
-
在cmd窗口中:
dir c:\Users\Akiper\.ssh;在 git-bash 中:ls ~/.ssh/— 文件在吗?如果没有,那里有什么文件? -
查看
ssh-keygen输出的最后两行。发生了一些可疑的事情。 -
您在按 Enter 输入文件名之前是否不小心输入了一个空格?看起来没有使用默认值。
-
@phd 当我输入时,我得到以下
ls: cannot access `/c/Users/Akiper/.ssh/`: No such file or directory -
这个版本的
ssh-keygen似乎有一个bug;它应该要么创建目录/c/Users/Akiper/.ssh/要么报告错误,而不是默默地做......不管它做了什么。