MXOXW

Life always finds a way.

git多账户

| Comments

1
2
3
ssh-keygen -t rsa -C "[email protected]"    // 添加key

Enter file in which to save the key (/c/Users/Administrator/.ssh/id_rsa): XXX //修改默认名称

.ssh目录添加config文件
修改内容

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Host *.a.com
IdentityFile ~/.ssh/id_rsa
User WWW

Host github.com
IdentityFile ~/.ssh/github
User YYY

Host git.coding.net
IdentityFile ~/.ssh/coding
User XXX

// Host github2
// HostName github.com
// IdentityFile ~/.ssh/github
// User YYY
// 使用方式:
// git clone github2:YYY/Mywork.git
// git clone git@github2:YYY/Mywork.git

参考:

http://www.cnblogs.com/BeginMan/p/3548139.html
http://www.tuicool.com/articles/7nMBVf

评论