公司和自己github配置两套git账号
使用这个生成自己公司默认的git账户
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
然后通过这个命令创建自己账户,我是github账户,然后输入
ssh-keygen -t rsa -C "你的邮箱" -f ~/.ssh/起个文件名
我起的名字是github.id_rsa
ssh-keygen -t rsa -C "你的邮箱" -f ~/.ssh/github.id_rsa
给他们分别添加到ssh-agent信任列表
ssh-add ~/.ssh/id_rsa
ssh-add ~/.ssh/github.id_rsa
这样就添加进去了。
分别将公钥放到不同的网站里面。
在config文件配置多个ssh-key
然后在~/.ssh目录下新建config文件,
#公司
Host company.gitee.com
Hostname gitee.com
IdentityFile ~/.ssh/id_rsa
User company
#个人
Host me.gitee.com
Hostname gitee.com
IdentityFile ~/.ssh/id_rsa_personal
User me
测试链接
ssh -T git@github.com
看到这样就说明创建成功了。
Hi suyunxue! You've successfully authenticated, but GitHub does not provide shell access.