Git 设置多个ssh-key对应多个项目
①:生成ssh-key
运行命令: ssh-keygen -t rsa 创建多个key保证名称不一致即可、目前创建了 id_rsa_test、id_rsa_ test1 用于演示config文件编写

②:配置config文件 没有config文件直接创建一个就行 config文件在.ssh目录下
Host test 注:可以随便写、关联远程仓库时需要用到
HostName github.com 注:服务器地址 自行选择
IdentityFile C:\\Users\\Administrator\\.ssh\\id_rsa_test 注:对应的文件
PreferredAuthentications publickey
User username_1
Host test1
HostName github.com
IdentityFile C:\\Users\\Administrator\\.ssh\\id_rsa_test1
PreferredAuthentications publickey
User username_2
③:添加key

④:项目关联

注: "git@" 后面是config文件中的对应的Host值

浙公网安备 33010602011771号