美文网首页
linux 上建立ssh key,添加到ssh-agent

linux 上建立ssh key,添加到ssh-agent

作者: 温润如玉00 | 来源:发表于2018-01-10 16:41 被阅读0次

使用github时,遇到问题:

Permission denied (publickey).

fatal: Could not read from remote repository.

解决办法:

1 打开命令行,执行如下命令:

ssh-keygen -t rsa -b 4096 -C "your_email@example.com"

此命令会生成两个文件,id_rsa,和id_rsa.pub.

当提示"Enter a file in which to save the key," 时,按回车,将生成的文件存储到默认位置,然后再根据提示按两次回车

2 执行如下命令,打开ssh-agent

eval "$(ssh-agent -s)"

Add your SSH private key to the ssh-agent. If you created your key with a different name, or if you are adding an existing key that has a different name, replace id_rsa in the command with the name of your private key file.

3 执行如下命令,将ssh key 添加到ssh-agent:

ssh-add ~/.ssh/id_rsa

4 将我们生成的key添加到github 账户中,添加办法:点这里.

相关文章

网友评论

      本文标题:linux 上建立ssh key,添加到ssh-agent

      本文链接:https://www.haomeiwen.com/subject/vqdekxtx.html