整理Mac下如何生成ssh key 使用gitlab
一、檢查是否已經(jīng)存在
ls -al ~/.ssh
會有兩種情況:
1、不存在 即沒有文件id_rsa.pub 或 id_dsa.pub
此時需要執(zhí)行命令 ssh-keygen -t rsa -C "your_full_name@xxxxx.com"
連續(xù)回車即可
此時再次查看? 就會出現(xiàn)id_rsa.pub 或 id_dsa.pub這兩個文件?
將公鑰放到剪貼板
pbcopy < ~/.ssh/id_rsa.pub
2、存在文件id_rsa.pub 或 id_dsa.pub
直接復(fù)制公鑰到粘貼板
pbcopy < ~/.ssh/id_rsa.pub
二、去gitlab添加ssh