Host key verification failed.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
在 git clone 項目時,提示沒有權限,不能clone,有以下幾種情況
1、可能是 之前電腦使用過git ,現在和之前不是同一個賬號,要重置。
git config --system --unset credential.helper
輸入上面命令后,再次git clone時,會讓我們重新輸入 username 和 password.
注:設置 修改 本地 git 賬號和密碼:
$ git config --global user.name "yourname" $ git config --global user.email "youremail"
2、設置后 重新 git clone 發現還是不行。
有可能是公鑰出現問題,重新設置用戶名和密碼,生成公鑰(這里要記得刪除之前的公鑰)
$ git config --global user.name "yourname" $ git config --global user.email "youremail"
刪除 .ssh 文件夾
路徑:
git 輸入命令
$ ssh-keygen -t rsa -C "youremail"(設置的郵箱地址)
然后會生成 .ssh文件夾。
打開 .ssh文件下的id_rsa.pub 全部復制,進入git ->setting ->ssh key 新增 ssh key即可。