NEW CASE STUDY: How we built top-rated shopping apps for Crate & Barrel and CB2
This article is useful for the developer who is dealing with multiple git accounts.
The following steps are the list of command which will help you when dealing with multiple git accounts. Simply copy and paste the commands on your terminal and check the code from your repository.
id_dsa.pub
id_ecdsa.pub
id_ed25519.pub
id_rsa.pub
Tip: If you don’t have an existing public and private key pair, or don’t wish to use any of that are available to connect to GitHub, then generate a new SSH key.
ssh-keygen -t rsa -b 4096 -C "personalEmail@gmail.com"
ssh-keygen -t rsa -b 4096 -C "workEmail@work.com"
ssh-keygen -t rsa -b 4096 -C "freelanceEmail@work2.com"
ssh-add -K ~/.ssh/id_rsa
ssh-add -K ~/.ssh/id_rsa_work
ssh-add -K ~/.ssh/id_rsa_work2
ssh-add -l
This will list the fingerprints of all identities.
$ pbcopy < ~/.ssh/id_rsa.pub
# Copies the contents of the id_rsa.pub file to your clipboard
This will list the fingerprints of all identities.
Tip: If pbcopy isn’t working, you can locate the hidden .ssh folder by opening the file in your favorite text editor and copying it to your clipboard.
cd ~/.ssh
touch config
# Personal GitHub account
Host github.com
HostName github.com
User git
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/id_rsa
# Work VSTS account
Host vs-ssh.visualstudio.com-work
HostName vs-ssh.visualstudio.com
User git
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/id_rsa_work
# Work2 GitHub account
Host github.com-work2
HostName github.com
User git
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/id_rsa_work2
In my case, my personal and freelance accounts are on GitHub, and my work account is on VSTS.
Copy the clone URL from Github (from work2 account) and modify as below.
Original url:
git clone git@github.com:(Repo path).git
Modified url:
git clone git@github.com-work2:(Repo path).git
Paste this (modified) URL onto the terminal.
Go into the repository folder from terminal and paste this command.
git config user.name "work2"
git config user.email "freelanceEmail@work2.com"
1.Delete all identities.
ssh-add -D
2. For more help, use the following commands.
ssh -help
ssh-add -help
Our emails are (almost) as cool as our digital products.
Your phone will break before our apps do.
© 2025, Heady LLC.