# 遇到訊息
1
Please make sure you have the correct access rights and the repository exists

設定 SSH 金鑰

step:

重設git的設定識別資料

設定

1
2
git config --global user.name "Luke Lin"
git config --global user.email milletbard@gmail.com

查看

1
2
git config user.name
git config user.email

刪除 .ssh 資料夾

Finder文件夾中,按command-shift + G 。 搜尋 ~/.ssh

刪除找到的known_hosts 檔案,刪除對其他主機的密鑰檢查,之後 ssh 將再次重新創建文件。

生成密鑰

1
2

ssh-keygen -t rsa -C "your@email.com"

接著會看到

1
2
# Generating public/private rsa key pair.
# Enter file in which to save the key (/Users/your_user_directory/.ssh/id_rsa):

直接按 enter 即可

接著.ssh 檔案夾會產生 id_rsaid_rsa.pub 這兩支檔案

id_rsa.pub右鍵,打開檔案的應用程式 => 文字編輯(預設值)

複製全部內容

設定SSH keys

SSH keys settings 裡,找到SSH and GPG keys => New SSH key
把剛剛id_rsa.pub的內容複製到key內容裡,按下add SSH key

回到 git

輸入

1
ssh -T git@github.com

輸入: yes

完成 SSH 金鑰設置,接下來就可以重新提交檔案了