生成sshkeyssh-keygen -t ras -C "youremail@yourcompany.com"这时可以一路回车,不输入任何字符,将自动生成id_rsa和id_rsa.pub文件。生成并添加第二个ssh keyssh-keygen -t rsa -C "youremail@gmail.com" : 这时不能一路回车,否则邮箱将覆盖上一次生成的ssh key,给这个文件起一个名字, 比如叫 id_rsa_github,所以相应的也会生成一个 id_rsa_github.pub 文件。添加ssh key$ ssh-add ~/.ssh/id_rsa$ ssh-add ~/.ssh/id_rsa_github在 ~/.ssh 目录下新建一个config文件touch config# gitlabHost gitlab.com HostName gitlab.com PreferredAuthentications publickey IdentityFile ~/.ssh/id_rsa# githubHost github.com HostName github.com PreferredAuthentications publickey IdentityFile ~/.ssh/id_rsa_github测试$ ssh -T git@github.com转自:
转自: