You will need to turn up logging. On the client side, "ssh -v" will which private key was used. On the server side, default log levels will only show that a public key was used (as opposed to password auth). You will need to set the logging level in sshd_config to at least VERBOSE.
Summary. SSH keys are used to authenticate secure connections. Following this guide, you will be able to create and start using an SSH key. Git is capable of using SSH keys instead of traditional password authentication when pushing or pulling to remote repositories.
Once your key is open, you want to select Conversions -> Export OpenSSH key and save it to HOME\. ssh\id_rsa . After you have the key at that location, Git Bash will recognize the key and use it.
The following entry in .ssh/config
file solves the problem
host git.assembla.com
user git
identityfile ~/.ssh/whatever
Where ~/.ssh/whatever
is a path to your private key
Additionally, user and host can be picked up from
git push [email protected]:repo_name.git
^__ ^_______________
user host
Executing ssh in verbose mode, aka ssh -v user@host
, will print a huge load of debugging info, which also contains details on which keyfiles it is trying for login.
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/user/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 332
debug1: read PEM private key done: type RSA
debug1: Authentication succeeded (publickey).
Now if you combine this, with the Step 4 in Git's own SSH help page, ssh -vT [email protected]
can give you the answer.
Note: You can also use the -i
switch to tell ssh during command execution, which keyfile to use.
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 question.
Unless it is specified on the .ssh/config
it will use the default private key file.
The default file is ~/.ssh/id_rsa
or ~/.ssh/id_dsa
or ~/.ssh/identity
depending on the protocol version.
This might be super edge, but after running ssh -vT [email protected]
it showed me it was checking /root/.ssh
for the keys, I was expecting it to check my home directory and then I realized I was logged in as root!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With