Git
Using a Specific SSH Private Key When Using Git Command
Using ssh-agent
ssh-agent bash -c 'ssh-add ~/.ssh/id_rsa_other; git clone git@github.com:user/project.git'
ssh-agent bash -c 'ssh-add ~/.ssh/id_rsa_other; git pull'
Using SSH Config File
cat ~/.ssh/config
Host github-work
HostName github.com
IdentityFile ~/.ssh/id_rsa_work
Host github-personal
HostName github.com
IdentityFile ~/.ssh/id_rsa_personal
git clone git@github-work:user/project.git
git clone git@github-personal:user/project.git
Using core.sshCommand
Configuring core.sshCommand
git clone -c "core.sshCommand=ssh -i ~/.ssh/id_rsa_work" git@github.com:user/project.git
Persisting core.sshCommand on Repository Level
git config core.sshCommand "ssh -i ~/.ssh/id_rsa_other"
git config --get core.sshCommand
git pull
