git - Mac OS,使用 Git : “no such file” 生成 SSH key 时出错

标签 git macos ssh

我想使用 GitHub 和多个帐户。 我正在关注 this tutorial ,我需要为我们的第二个 GitHub 帐户生成一个唯一的 SSH key 并遇到一个问题:

Saving key "~/.ssh/id_rsa_nettuts" failed: No such file or directory

有一个非常相似answer , 而答案都是窗口,不起作用。

代码如下:

$ ls                 
id_rsa      id_rsa.pub  id_rsa_nettuts  known_hosts
$ ssh-keygen -t rsa -C "houReal@gmail.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/hou/.ssh/id_rsa): ~/.ssh/id_rsa_nettuts
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Saving key "~/.ssh/id_rsa_nettuts" failed: No such file or directory
$

非常感谢。

最佳答案

希望你在 .ssh 目录中。当您输入 key 名称时,只需输入文件名而不是路径。例如:

ssh-keygen -t rsa -C "houReal@gmail.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/home/hp/.ssh/id_rsa): id_rsa_netus
Enter passphrase (empty for no passphrase): 
Enter same passphrase again:

关于git - Mac OS,使用 Git : “no such file” 生成 SSH key 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47805504/

相关文章:

macos - Mac OS X 上的 gcc : how to link libraries installed with MacPorts?

php - 不同服务器上相同数据的 SimpleXML 差异

通过 SSH 隧道进行 MySQL 复制

git - 如何找出我的功能分支是从哪个共享分支分支的

git - 恢复到之前的提交并忽略 git 中任何未提交的更改

python - 用空格键中断计时器

linux - 脚本内 SSH 命令中的变量

security - 通过SSH查找/替换根目录中的所有文件

git - 在 bash 脚本中执行 git 命令

Git merge/cherry-pick 避免暂存