mac电脑配置多个git账户

公司和自己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.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值