同一个 ssh-key 不容许在同平台的多个帐号当中使用。git
咱们能够生成多个 ssh-key, 经过 config 来配置 ssh-key 对应的平台与帐号。github
生成另外的ssh-keyssh
ssh-keygen -t rsa -C "youremail@email.com"
此时将提示输入密钥文件名(文件名 = 路径/文件名)gitlab
输入密码,或直接回车,生成 ssh-key测试
在 C:/Users/用户名/.ssh
spa
若是 ~/.ssh/config
文件不存在,须要建立并设置(无后缀)code
其中 Host
为别名,对应 id_rsa_gitlab
,HostName
为对应平台blog
id_rsa.pub
已经添加到我本身的 gitlab 帐号中id_rsa_gitlab.pub
的内容添加到另外的 gitlab 帐号中ip
git remote add origin git@other.github.com:other13398334423/example-project.git // 注意: other.github.com