Step 1 - Create a New SSH Key
We need to generate a unique SSH key for our second GitHub account.
ssh-keygen -t rsa -C "your-email-address"
Be careful that you don't over-write your existing key for your personal account. Instead, when prompted, save the file as id_rsa_COMPANY. In my case, I've saved the file to~/.ssh/id_rsa_nettuts.
Step 2 - Attach the New Key
Next, login to your second GitHub account, browse to "Account Overview," and attach the new key, within the "SSH Public Keys" section. To retrieve the value of the key that you just created, return to the Terminal, and type: vim ~/.ssh/id_rsa_COMPANY.pub. Copy the entire string that is displayed, and paste this into the GitHub textarea. Feel free to give it any title you wish.
Next, because we saved our key with a unique name, we need to tell SSH about it. Within the Terminal, type: ssh-add ~/.ssh/id_rsa_COMPANY</

本文介绍如何为个人和公司GitHub账号分别设置独立的SSH密钥,包括创建新的SSH密钥、附加新密钥到GitHub账户、创建配置文件以及测试流程。
最低0.47元/天 解锁文章
1021

被折叠的 条评论
为什么被折叠?



