Step 1: Step 1: Generate SSH and Add it to ssh-agent
Note: if you have two github accounts, you need to generate two SSH Key
Step 2: Configure ~/.ssh/config
Note: In order to access the different account, you must use the hostname specified inside the ~/.ssh/config file. Here is my example:
$ cat .ssh/config Host * ServerAliveInterval 240 # garyliu1119 account Host github1119.com HostName github.com AddKeysToAgent yes IdentityFile ~/.ssh/id_ed25519 IdentitiesOnly yes # garyliu19 account Host github19.com HostName github.com AddKeysToAgent yes IdentityFile ~/.ssh/id_rsa IdentitiesOnly yesWhen I clone the github repo, I use the following command:
git clone -b develop git@github19.com:garyliu19/FN-External-API.gitNote: the domain name is: github19.com, instead of github.com