- Mac重置后,對SSH配置做個筆記,預(yù)防忘記
一、生成SSH
- 執(zhí)行
ssh-keygen -t rsa -C "youremail@example.com,會在.ssh目錄下生成id_rsa、id_rsa.pub兩個文件私鑰和公鑰
ssh生成截圖 - 通過
cat ~/.ssh/id_rsa.pub查看公鑰,并將公鑰整體復(fù)制,配置到GitHub等后臺。
公鑰
從頭到尾都復(fù)制,放到key中 然后自動會生成 RW 鑰匙那個樣子
復(fù)制公鑰到github
復(fù)制生成后
二、配置本地SSH
- 執(zhí)行ssh-add ~/.ssh/id_rsa將sshkey添加到sourceTree(會輸入密碼)
- 執(zhí)行ssh-add -K ~/.ssh/id_rsa將sshkey添加到鑰匙串
- cd 到 .ssh目錄下, 用touch config命令創(chuàng)建config文件
- 執(zhí)行open config, 打開config文件,輸入以下內(nèi)容并保存
Host *
UseKeychain yes
AddKeysToAgent yes
IdentityFile ~/.ssh/id_rsa
三、公鑰信任
-
執(zhí)行ssh命令鏈接一下git服務(wù)器,進行公鑰信任
公鑰信任
四、打開Source Tree克隆

sourcetree克隆代碼




