Thanks Eric for the tutorial
I have 2 github accounts, one for my own and one for the company.
On the company laptop, I have copied my own github ssh keys. But the new company github account has no ssh key yet.
Let’s denote the 2 accounts as follows:
ssh-keygen -t rsa -C "firstname.lastname@example.org"
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
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:
cat ~/.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. If successful, you’ll see a response of “Identity Added.”
Now, it’s time to specify when we wish to push to our personal account, and when we should instead push to our company account. To do so, let’s create a config file.
~/.ssh/config, if it doesn’t exist, create it by
Now, add the following to the config file:
To push the repo to your own github account:
git remote add origin git@github:yingchi/fastai-notes.git
To push the repo to company github account:
git remote add origin git@github-COMPANY:COMPANY/testing.git
Clone from company private repo:
git clone git@github-COMPANY:COMPANY/lalala.git
$ git config user.email "email@example.com"
Confirm that you have set the email address correctly in Git:
$ git config user.email