1. 程式人生 > 實用技巧 >git clone專案 許可權 問題

git clone專案 許可權 問題

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即可。