Ubuntu下
如我使用的是阿里云,里面创建了一个git项目
在Ubuntu14.04下拉取该项目
当你是第一次git clone .......时,报错如下
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
上面以SSH方式访问用项目出现权限问题
查看~/.ssh是否有文件id_rsa以及文件id_rsa.pub
下面记录下解决办法:
1.首先,如果你没有ssh key的话,在ternimal下输入命令:ssh-keygen -t rsa -C "youremail@example.com", youremail@example.com改为自己的邮箱即可,途中会让你输入密码啥的,不需要管,一路回车即可,会生成你的ssh key。(如果重新生成的话会覆盖之前的ssh key。)

生成的id_rsa.pub,将里面的内容复制,进入你的github账号,在settings下,SSH and GPG keys下new SSH key,title随便取一个名字,然后将id_rsa.pub里的内容复制到Key中,完成后Add SSH Key。
来源:CSDN
作者:qq_34738528
链接:https://blog.csdn.net/qq_34738528/article/details/102796589