cd ${your repo dir}
git config user.name "FIRST_NAME LAST_NAME"
git config user.email "MY_NAME@example.com"
git config core.sshCommand "ssh -i ~/.ssh/id_rsa_xxx"
Sample
比如~/.ssh下生成了personal和company两个ssh key, 如何生成ssh key
ls ~/.ssh
id_rsa_my_personal
id_rsa_my_personal.pub
id_rsa_my_company
id_rsa_my_company.pub
...
为单个仓库指定ssh key
cd ${your repo dir}
git config core.sshCommand "ssh -i ~/.ssh/id_rsa_my_personal"
# Mac上再执行
ssh-add --apple-use-keychain ~/.ssh/id_rsa_my_personal
查看${your repo dir}/.git/config