1. 程式人生 > >Git - 提交時沒有許可權解決方法

Git - 提交時沒有許可權解決方法

Git - 提交時提示“Please make sure you have the correct access rights and the repository exists.”的解決方法


1.首先開啟Git Bash設定名字和郵箱:

git config --global user.name "你的名字"

git config --global user.email "你的郵箱"

2.刪除.SSH檔案下的known_hosts(.SSH在C:\Users\Windows使用者名稱目錄下)

3.生成ssh公鑰認證所需的公鑰和私鑰檔案

ssh-keygen -t rsa -C "你的郵箱"

然後會出現以下內容

Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/Administrator/.ssh/id_rsa):
/c/Users/Administrator/.ssh/id_rsa already exists.
Overwrite (y/n)? y(輸入y)
Enter passphrase (empty for no passphrase):(回車)

Enter same passphrase again:(回車)

然後系統會自動在.ssh資料夾下生成兩個檔案,id_rsa和id_rsa.pub,用記事本開啟id_rsa.pub,將裡面的內容複製到下面這裡

4.在Git中輸入ssh -T [email protected]驗證與github連線是否成功時

The authenticity of host 'github.com (13.250.177.223)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
Are you sure you want to continue connecting (yes/no)? yes(輸入yes)
Warning: Permanently added 'github.com,13.250.177.223' (RSA) to the list of known hosts.

Hi XXX! You've successfully authenticated, but GitHub does not provide shell access.