git Could not read from remote repository.Please make sure you have the correct access rights.
git "Could not read from remote repository.Please make sure you have the correct access rights."
問題分析:
出現(xiàn)這個問題是因為沒有在github賬號添加SSH key
解決方法如下:
1.在終端輸入
ssh-keygen -t rsa -C "username"(注:username為你git上的用戶名)
如果執(zhí)行成功。返回
首先,說明一下,這里的username是你電腦上的用戶名
然后,在這里就是設(shè)置存儲地址了.我們直接按回車,會出現(xiàn)一下兩種情況的一種:
(1)如果正常運行的話,會出現(xiàn)
Enter passphrase (empty for no passphrase):然后我們直接回車
(2)有的時候我們可能會出現(xiàn)
/Users/your username/.ssh/id_rsa already exists. Overwrite (y/n)?這說明你已經(jīng)設(shè)置了存儲地址,我們輸入“y”覆蓋
Overwrite (y/n)? y回車
上面的任意兩種情況之后,會出現(xiàn)
Enter same passphrase again:再次回車,這時候你會看見:
Your identification has been saved in /Users/username/.ssh/id_rsa.Your public key has been saved in /Users/username/.ssh/id_rsa.pub.The key fingerprint is:58:42:8b:58:ad:4b:b5:b9:6d:79:bf:8c:f9:e2:2b:ed usernameThe key's randomart image is:+--[ RSA 2048]----+| ... || o oo. || . .ooo. || o o+ || . ..oS. || . . + . || . o . || . o+. || +E++. |+-----------------+ ---------------------這說明SSH key就已經(jīng)生成了。文件目錄就是:
/Users/username/.ssh/id_rsa.pub.我們執(zhí)行cat命令查看文件的內(nèi)容:
cat /User/username/.ssh/id_rsa.pub這時候會看見:
ssh-rsa AAAAB3NzaC1yc2。。。。。。。。。后面的內(nèi)容我省略了
(說明:ssh-rsa 后面的內(nèi)容這就是你的SSH keys)
把顯示出來的SSH keys直接添加到github賬戶設(shè)置里邊的SSH keys
最后再執(zhí)行
命令就可以了
總結(jié)
以上是生活随笔為你收集整理的git Could not read from remote repository.Please make sure you have the correct access rights.的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。