使用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 账户中,添加办法:点这里.