使用原生程式碼上傳到github庫的時候出現Permission denied 錯誤
$ git push -u origin main
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
由於重灌系統,之前的配置資訊都不存在了,所以SSL的認證資訊需要重新建立。
- 在系統執行下面命令
$ ssh-keygen -t rsa -b 4096 -C "Your Email Address"
- 使用cat命令輸出id_rsa.pub檔案內的內容
$ cat ~/.ssh/id_rsa.pub
- 複製cat輸出的內容到github
github的複製位置為github.com/settings/keys
如果之前已經建立了SSH key,只需要新增一個新的就可以了
[Reference]
GitHub: Permission denied (publickey). fatal: Could not read from remote repository
本作品採用《CC 協議》,轉載必須註明作者和本文連結