版权声明:未经允许不得转载。 https://blog.csdn.net/qq_35958788/article/details/82941233
生成多个ssh key
- 命令:
ssh-keygen -t rsa -C "[email protected]"
- 在~/.ssh运行该命令并指定路径及文件,创建多个ssh key
- 默认创建id_rsa,id_rsa.pub到当前文件下(此处为id_rsa_home, id_rsa_home.pub)
创建config文件
- 在当前文件下创建config,并添加以下配置
# one([email protected])
Host personal.github.com
HostName github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/keys/id_rsa_home
User harry0349
部署
- 将相应的pub key 放置到git指定的SSH and GPG keys处。
使用
- clone
#原来写法
git clone [email protected]: one/project.git
#现在
git clone [email protected]: one/project.git
- 给仓库设置局部的用户名和邮箱
$ git config user.name "one_name"
$ git config user.email "one_email"