GIt (Mac) / 筆記 · 2020-03-03

Git Permission denied (publickey)

1.確認登入github

git config --global user.name "yourname"
git config --global user.email "youremail"

2.進入SSH目錄

cd ~/.ssh

自行建創目錄
mkdir ~/.ssh

3.檢查SSH是否連結到github.com

ssh -T git@github.com

連結成功

> The authenticity of host 'github.com (ip)' can't be established. RSA key fingerprint is......
Are you sure you want to continue connecting (yes/no)? yes

顯示金鑰內容
如需要更新可拷貝內容貼到Gitlab > SSH Keys > Add Key

cat ~/.ssh/id_rsa.pub

連結失敗》

刪除ssh key

ssh-add -D<br>rm -r ~/.ssh

建立金鑰

ssh-keygen -t rsa -C "youremail"