1、进入.ssh目录
2、重命名id_rsa及id_rsa.pub
3、创建config文件,config内容如下:
#gitlab Host gitlab.com HostName gitlab.com User xxx PreferredAuthentications publickey IdentityFile ~/.ssh/id_rsa_gitlab #github Host github.com HostName github.com User xxx PreferredAuthentications publickey IdentityFile ~/.ssh/id_rsa_github
4、设置提交用户名等
git config --global user.name "xxx" git config --global user.email "xxx@xx.com"
5、cat id_rsa_gitlab.pub或 id_rsa_github.pub填入gitlab或github SSH Keys即可