- 創(chuàng)建ssh-key
ssh-keygen -t rsa -f ~/.ssh/文件名 -C "郵箱地址"
# 可不填密碼
# 如: $ ssh-key -t -f ~/.ssh/id_rsa.gitLab -C "ccsxlx@163.com"
- 獲取ssh
cat xxx.pub
# 如: $ cat id_rsa.gitLab.pub
# 一定通過cat復(fù)制獲取,因為vim打開獲取.pub可能不準確
到代碼管理網(wǎng)站填充ssh
創(chuàng)建config文件
cd ~/.ssh
touch config
vim config

config文件.png
Host是別名,Hostname是地址如:github.com,gitee.com等
通過別名可以驗證ssh是否成功如命令:$ ssh -T 別名
參考:https://blog.csdn.net/maoxinwen1/article/details/80269299