1.1 清除原有 git 的全局配置
$ git config --global --list
$ git config --global --unset user.name "chenlan"
$ git config --global --unset user.email "739904595@qq.com"
1.2 生成 ssh keys
$ ssh-keygen -t rsa -f ~/.ssh/id_rsa.github -C "739904595@qq.com"
$ ssh-keygen -t rsa -f ~/.ssh/id_rsa.gitee -C "739904595@qq.com"
1.3 将私钥添加到 ssh agent 中
$ ssh-agent bash
$ ssh-add ~/.ssh/id_rsa.github
$ ssh-add ~/.ssh/id_rsa.gitee
1.4 配置 config 文件
$ touch ~/.ssh/config
# gitHub
Host github.com
HostName github.com
User chenlan
IdentityFile ~/.ssh/id_rsa.github
# gitee
Host gitee.com
HostName gitee.com
User chenlan
IdentityFile ~/.ssh/id_rsa.gitee
1.5 添加 ssh key
Setting -> SSH and GPG keys -> NEW SSH key
|