- ssh key放到~/.ssh下
- 在~/.ssh目录下创建config文件
- config文件内容格式如下:
Host [target-host]
Hostname [target-host-name]
Port [target-port]
IdentityFile [key-path]
User [user-name]
- git操作时,就会根据目标host读取对应配置的ssh key
Host [target-host]
Hostname [target-host-name]
Port [target-port]
IdentityFile [key-path]
User [user-name]