Say your .ssh
directory contains 30 keys (15 private and 15 public).
Where in Git can one check which one is used to connect to a given remote repository?
I'd say most practical to my taste would be:
GIT_SSH_COMMAND='ssh -v' git …
of course, depending on circumstances it might be beneficial just to export it to current SHELL's environment so that you won't have to prepend it manually each time. Then it'd be this way:
export GIT_SSH_COMMAND='ssh -v'
git …
— As man git
suggests there're a few of environmental variables that would affect Git's operations with use of SSH. According to man ssh
you can get some debugging info when deploying -v
option (not only but also, check out the manual if you're curious for more).
which key is used?
In the output you would see smth like …
debug1: Offering public key: …
… which is the answer to your q-n.