- git config --global user.name “yourname”
- git config --global user.email“xxxxxxxxx.com"
- 除.ssh文件夾(直接搜索該文件夾)下的known_hosts(手動刪除即可,不需要git)
- $ ssh-keygen -t rsa -C "[email protected]"(請填你設置的郵箱地址)
- 出現:
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/your_user_directory/.ssh/id_rsa):
- 連續回車
- 然後系統會自動在.ssh文件夾下生成兩個文件,id_rsa和id_rsa.pub,打開id_rsa.pub,全部的內容複製
- 打開https://github.com/,添加ssh
- ssh -T [email protected]
- yes
- 關閉窗口,重新操作