生成密钥
ssh-keygen -t rsa -C "abc@qq.com"
Enter file in which to save the key (/Users/xxx/.ssh/id_rsa):
输入文件地址及名称
如:/Users/xxx/.ssh/xxxx-github
一直回车
配置config文件
添加ssh 配置
vi /Users/xxx/.ssh/config
Host git-xxxx
HostName git@xxxxx.com
AddKeysToAgent yes
UseKeychain yes
IdentityFile /Users/xxx/.ssh/git-xxxxx
将.ssh目录下的密钥添加到ssh-agent中
执行
ssh-add /Users/xxx/.ssh/git-xxxxx
验证是否配置成功,执行
ssh -T git@xxxxx.com