git多用户配置ssh key

  1. ssh key 生成
ssh-keygen -t rsa -C "[email protected]" -b 4096
  1. copy后贴到github或者gitlab,copy命令如下例:
  • Mac
pbcopy < ~/.ssh/github_rsa.pub
  • Linux
xclip -sel clip < ~/.ssh/github_rsa.pub
  1. 配置ssh config,配置文件位于~/.ssh/config。内容如下
Host github.com
   User getsu
   Hostname github.com
   IdentityFile ~/.ssh/github_rsa

Host gitlab.com
   User getsu
   Hostname gitlab.com
   IdentityFile ~/.ssh/gitlab_rsa

你可能感兴趣的:(git多用户配置ssh key)