git-tools icon indicating copy to clipboard operation
git-tools copied to clipboard

Failed to authenticate SSH session

Open naufraghi opened this issue 4 years ago • 2 comments

Perhaps related to #13 ?, I have an error on try-merge:

Failed to authenticate SSH session: Unable to open public key file; class=Ssh (23)

git and ssh are working fine, peculiarities are:

  • non standard ssh port
  • ed25519 key

naufraghi avatar Sep 27 '21 13:09 naufraghi

Sorry for the late reply! I got the notifications turned off for some reason. Unfortunately I think this will be hard to reproduce on my own, can you check one of these solutions?

  1. It seems I did not put the code to handle passphrase. If you have a passphrase locking your ssh key, this might be the issue. In that case I think it's best that you use ssh-agent because it will unlock the key before adding it to the running agent (I believe).

  2. The code that handles the credentials is here: https://github.com/cecton/git-tools/blob/72937393b65631cfe97e3b4cd13f6498f60b6dac/src/common.rs#L388-L426

    Perhaps you can you check if this looks good to you?

  3. I remember I had quite some issues getting this to work properly. Using git2_credentials was not enough.

    I suspect this could be the offending code:

    username_from_url.unwrap_or_else(|| user.to_str().unwrap()),
    

    If you force it to user instead, does it work better?

cecton avatar Dec 12 '21 10:12 cecton

Hi, thanks, no problem at all!

  1. the gnome keyring should act as an agent, or at least git works without asking. I'll double check if I still have the same error in a shell I'm sure can see the agent.
  2. I'll have a look there with some dbg!().
  3. Can be, my local username is not the remote user, or at least, not on all the servers, maybe dbg!() will help here too.

I hope to remember to have a look at this in the next few days, if not, feel free to close the issue!

naufraghi avatar Dec 12 '21 14:12 naufraghi