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 "[email protected]", [email protected]改爲自己的郵箱即可,途中會讓你輸入密碼啥的,不需要管,一路回車即可,會生成你的ssh key。(如果重新生成的話會覆蓋之前的ssh key。)
生成的id_rsa.pub,將裏面的內容複製,進入你的github賬號,在settings下,SSH and GPG keys下new SSH key,title隨便取一個名字,然後將id_rsa.pub裏的內容複製到Key中,完成後Add SSH Key。