How does git know which ssh key to use for its operations?
Git does not know, or care. It just runs ssh. How does ssh know? It looks at your ~/.ssh/config file (edit: or gets it from ssh-agent; see below): Host github.com # IdentitiesOnly yes # see below to decide if you want this IdentityFile ~/.ssh/github_id_file Host domain.com IdentitiesOnly yes # again, see below IdentityFile ~/.ssh/another_id_file Edit: … Read more