操作系统:mac
进入.ssh目录,创建名为config文件
cd /Users/xxx/.ssh
xxx改为你的电脑用户名。
查看是否有config文件:
ls
如果没有config文件,则创建config文件,然后打开:
touch config
有config文件,则直接打开config文件:
open config
在config文件中输入一下内容并保存:
Host github.com
HostName github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa
Host secondSSH.github.com
HostName github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/secondSSH
secondSSH为你的ssh名字。
使用secondSSH key的git 链接改为
git@secondSSH.github.com:your_second_project_github_address.git
到此配置完成。你可以提交代码了。