解決 Permission denied (publickey)
會得到 Permission denied 訊息的情況有很多種,我所遇到的情況是已經將 SSH Key 加入系統中並給予適當的權限,但仍然遇到錯誤訊息:
Cloning into 'your-repo'...
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
後來發現我們只需要在 .ssh 資料夾下增加一個 config 文字檔即可解決此問題:
Host gitlab.com
User git
Hostname gitlab.com
IdentityFile ~/.ssh/id_rsa
IdentitiesOnly yes
Environment :
・ Unix-like System