github与git链接问题

来源:互联网 发布:高校网络教育阳光招生服务平台 编辑:程序博客网 时间:2024/06/09 22:56

在Ubuntu中git与github链接出现问题


问题描述:git链接多个github账户


网上相关文章很多,自己做了一次,下面是简述
1:首先你自己之前肯定有原来账户,比如我之前已经存在了一个账户
私钥和公钥在./ssh文件夹下面,这个时候再需要创建一个账户
2:老途径,创建公钥和私钥
ssh-keygen -t rsa -C “hello@qq.com”
出现enter file in which to save the key 时候,要自己创建一个名,比如MY ,这个时候将my和my.pub存在.ssh文件下面。
3:这个时候的关键一部,使git识别两个私钥
touch config

Host github.com   HostName github.com   PreferredAuthentications publickey   IdentityFile ~/.ssh/id_rsa   Host my.github.com      HostName github.com      PreferredAuthentications publickey      IdentityFile ~/.ssh/my  

测试:
ssh -t git@github.com
ssh -t git@my.github.com
参考:
git链接多个github
git多个github出现问题