解決使用 GitHub 時出現的 “Permission Denied (publickey)” 錯誤|伊恩踩坑筆記

假設你在 git pull/push 遇到了以下的錯誤訊息,即表示該裝置並沒有將 SSH Key 加入到 GitHub 的 SSH Key 白名單中。可以參考 如何透過 ssh-keygen 在 Ubuntu Linux 或 MacOS 上產生 SSH Key 金鑰 來創建一個 SSH Key

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.

因為在 2021/08/13 起已經不支援 HTTPS 方式來管理專案了

Support for password authentication was removed on August 13, 2021. Please use a personal access token instead.

在本地的 Git 專案中,我先將本地的容器從 HTTPS 改為 SSH,並也在本地和 Server 各產生了一組 SSH Key 並添加到 GitHub 白名單中,問題即解決

git remote set-url origin ssh://git@abc.com:someproject.git

ING Design 応設計
https://www.theingdesign.com/

--

--

Ian aka BerLin / 伊恩踩坑筆記

專門寫一些自己曾經踩過的坑,希望你沒踩過 / Web & BackEnd Developer • 台北 • theingdesign.com • IG: @ianakaberlin