Skip to content

Latest commit

 

History

History
46 lines (37 loc) · 673 Bytes

mac配置多个ssh.md

File metadata and controls

46 lines (37 loc) · 673 Bytes

mac配置多个ssh key

  1. 进入ssh目录:
cd ~/.ssh
  1. 创建新的ssh key:
ssh-keygen -t rsa -C "[email protected]"

后续提示内输入name: id_rsa_tiger

  1. 创建config文件:
touch config

配置config:

# github
Host git
HostName github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa

# github tiger
Host git2
HostName github.com
PreferredAuthentications publickey
User [email protected]
IdentityFile ~/.ssh/id_rsa_tiger
  1. 添加密钥:
ssh-add ~/.ssh/id_rsa_tiger
  1. 到要用git2的仓库修改其git配置:
git config user.email "[email protected]"
git config user.name "tigerHee"