一、在git bash中执行

ssh-keygen -t rsa -C 'yangyuan@xxx.com' -f ~/.ssh/id_rsa_xxx 

二、添加配置

在用户目录的.ssh目录,即C:\Users\XXX\.ssh\目录,添加config文件

Host gitlab.xxx.com
HostName gitlab.xxx.com 
User git 
Port 22 
IdentityFile ~/.ssh/id_rsa
Host github.com 
HostName github.com 
User git 
Port 22 
IdentityFile ~/.ssh/id_rsa_xxx
Host git.xxx.com 
HostName git.xxx.com 
User git 
Port 22 
IdentityFile ~/.ssh/id_rsa_xxxx

在这里插入图片描述

三、 将公钥添加到远程仓库中

将id_rsa_xxx.pub文件中的所有字符串,添加到远程仓库,例如添加到github

在这里插入图片描述

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐