github客户端切换账号

1,生成新的密钥对

$  ssh-keygen -t rsa -C user2@email.com


2,把公钥添加到Github账户中


3,配置 ~/.ssh/config

Host githubuser2
    HostName github.com
    User user@email.com
    PreferredAuthentications publickey
    IdentityFile ~/.ssh/id_rsa_user2


4,配置Git全局变量


$ git config --global user.name "user2"  

$ git config --global user.email user2@email.com

或者编辑 ~/.gitconfig 文件


5,查看Git配置信息

$ git config --list


6,如果在push的时候报403错误(error: The requested URL returned error: 403 Forbidden while accessinghttps://github.com/ ...)


找开项目下面的 .git/config 文件,找到 [remote "origin"],在github.com前面加上Github的用户名,如

url = https://githubuser@github.com/chenghui/myproject.git


注:文档没有写完,步骤3可以忽略。


参考文档:http://blog.csdn.net/wirelessqa/article/details/8572928






评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值