This guide explains how to manage multiple SSH accounts by configuring different SSH keys for each account in the ~/.ssh/config
file, testing the connection, and using the configured host in Git URLs when adding remote repositories.
~/.ssh/config
file nano ~/.ssh/config
Host github_development
HostName github.com
IdentityFile ~/.ssh/github_development
Host github_work
HostName github.com
IdentityFile ~/.ssh/github_work
ssh -T git@github_development
Enter passphrase for key '/home/development/.ssh/github_development': ••••••••
Hi kevenclient! You've successfully authenticated, but GitHub does not provide shell access.
Host
instead of HostName
in Git URL git remote add origin git@github_development:username/repository.git
git remote -v
origin git@github_development:username/repository.git (fetch)
origin git@github_development:username/repository.git (push)