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:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | $ 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 yes |
1 | git clone -b develop git@github19.com:garyliu19/FN-External-API.git |