1. 創(chuàng)建私鑰:
ssh-keygen -t rsa -C '你注冊的郵箱'
//或
ssh-keygen -t ed25519 -C "你注冊的郵箱"
//或
ssh-keygen -o -t rsa -b 4096 -C "你注冊的郵箱"
2. 保存文件路徑失都,這里我保存到了/Users/本人用戶/.ssh/id_ed25519
柏蘑,默認(rèn)不用輸入
3. 輸入密碼:不輸入可以留空
4. 結(jié)束顯示信息,私鑰和公鑰位置
/Users/本人用戶/.ssh/id_ed25519
/Users/本人用戶/.ssh/id_ed25519.pub
5. 將公鑰信息拷貝到剪貼板
mac: pbcopy < /Users/本人用戶/.ssh/id_ed25519.pub
win: cat ~/.ssh/id_ed25519.pub | clip
格式如下
ssh-ed25519
生成的公鑰
你的郵箱
6. 添加公鑰到官網(wǎng)
https://gitlab.com/profile/keys
其他系統(tǒng)請參考官方教程:
https://gitlab.com/help/ssh/README.md