The following methods will tell git which private key to use.
For Git version 2.3.0+, you can use the environment variable
GIT_SSH_COMMAND="ssh -i ~/.ssh/id_rsa_example" git clone example
-i can sometimes be overridden by your config file,
in which case you should give SSH an empty config file:
GIT_SSH_COMMAND="ssh -i ~/.ssh/id_rsa_example -F /dev/null" git clone example
For Git version 2.10.0+, you can configure this per repo or globally, so you don’t have to set the environment variable:
git config core.sshCommand "ssh -i ~/.ssh/id_rsa_example -F /dev/null"
You can also specify the private key using the
Host github.com User git Hostname github.com IdentityFile ~/.ssh/id_rsa