Kai Schneider Kai Schneider - 1 year ago 265
Git Question

Show ssh key file in git bash

How can see which ssh key file is used in the git bash. I tried "git config --get-all" but I get the error message "error: wrong number of arguments; usage: git config [options]"

Answer Source

Which SSH key is used isn't determined by git, but by the SSH client itself. Either the appropriate key is configured in ~/.ssh/config, or ssh just tries all keys it can find when connecting to the host. You can see which key ultimately succeeded by connecting to the host with the standard SSH client. For example, when using Github:

ssh -v git@github.com

This will give you something a bit like this:

debug1: Offering RSA public key: /home/me/.ssh/id_rsa
debug1: Authentications that can continue: publickey
debug1: Offering RSA public key: /home/me/.ssh/id_rsa2
debug1: Server accepts key: pkalg ssh-rsa blen ****

This tells you that the key .../id_rsa2 was the one accepted by the server.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download