1.检查是否已经有SSH Key。
$ cd ~/.ssh
2.生成一个新的SSH。
$ ssh-keygen -t rsa -C "email"
3.添加ssh key到GitHub/GitLab
在GitHub/GitLab上找到关于SSH keys->add key把id_rsa.pub公钥的内容复制进去就可以了。
4.配置账户
$ git config --global user.name “your_username” #设置用户名
$ git config --global user.email “your_registered_github_Email” #设置邮箱地址(建议用注册giuhub的邮箱)
5.最后一步测试是否成功:
ssh -T git@"你的gitlab服务器地址"