在同一个机器上用github账号登录(一台机器多个公钥)

1、首先生成你要的公钥比如说id_rsa_github_codinlog
2、生成之后把id_rsa_github_codinglog里面的内容添加到github的accounts设置中
添加公钥
3、编辑~/.ssh/config 文件加入下面内容
#coding github 的认证
Host github-codinglog
Hostname github.com
User git
IdentityFile /home/kimi/.ssh/id_rsa_github_codinglog

第一行注释
第二行是名称
第三行是主机名(不可变)
第四行 用户 不可变一定要是git
第五行是私钥的地址

4、添加公钥给ssh-agent
a、确认下ssh-agent是否允许,ps ax|grep ssh-agent
b、添加私钥 ssh-add id_rsa_github_codinglog

5、验证是否成功
ssh git@github-codinglog
成功则返回
Hi codinglog! You've successfully authenticated,

but GitHub does not provide shell access Connection to github.com closed.

6、从源中取出代码
a、如果是首次取出
mkdir ideacollector
cd ideacollector
git init
touch README
git add README
git commit -m 'first commit'
git remote add origin git@github-codinglog:codinglog/ideacollector.git
git push origin master
b、如果源里面有代码了
直接git@github-codinglog:codinglog/ideacollector.git

参考:
http://github.com/guides/multiple-github-accounts