Skip to content

Instantly share code, notes, and snippets.

@lizzie
Last active December 25, 2015 18:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lizzie/7021747 to your computer and use it in GitHub Desktop.
Save lizzie/7021747 to your computer and use it in GitHub Desktop.
Multiple SSH Keys settings for different github account
$ more ~/.ssh/config
Host github.com_ls
HostName github.com
User lizziesky@gmail.com // 邮箱或者账户名
IdentityFile ~/.ssh/id_rsa_ls
Host github.com
HostName github.com
User shengyan1985@gmail.com
IdentityFile ~/.ssh/id_rsa
// like https://gist.github.com/jexchan/2351996
// 生成不同 ssh pub key, 添加到不同 github 账号 setting 的 ssh-key 中
// github 上不同账号的不同库对另一个账号没有读写全限时,
$ git clone git@github.com_ls:sunsetsunrise/xxx.git 获取 lizziesky@gmail.com 账户下的仓库
$ git clone git@github.com:lizzie/yyy.git 获取 shengyan1985@gmail.com 账户下的仓库
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment