一 、設定郵箱
設定Git的user name和email:
$ git config --global user.name "lili"
$ git config --global user.email "[email protected]"
設定完後檢視使用者名和郵箱
git config --global user.name
git config --global user.email
二、生成SSH密鑰過程:
1 檢視本地有沒有 cat ~/.ssh/id_rsa.pub
2 若無,生成新的 ssh-keygen -t rsa -C "[email protected]"
按下三個回車,得到了兩個檔案:id_rsa和id_rsa.pub
3 複制id_rsa.pub裡面的key,cat ~/.ssh/id_rsa.pub
在gitlab裡面把sshkey粘貼到Settings裡面的SSH Keys
4 測試是否聯通 ssh [email protected]
三、拉取項目開始開發
1 git clone [email protected]:XXX/yourproject.git
2 後面省略之....
參考部落格
http://blog.csdn.net/hustpzb/article/details/8230454/
https://git-scm.com/book/en/v2/Git-on-the-Server-Generating-Your-SSH-Public-Key
https://en.wikipedia.org/wiki/Ssh-keygen