1

I'm running:

  • Windows 10 (latest updates)

  • Git version 'git version 2.36.1.windows.1'

  • SSH -V returns:

     OpenSSH_for_Windows_8.1p1, LibreSSL 3.0.2 

In the properties-dialog all executables inside C:\Windows\System32\OpenSSH* display:

 product version: 8.1.0.1 

(this is the default suite that Windows10 maintains - I never laid a finger on it myself)

  • The 'ssh-agent' is up and running 'ssh-add -l' displays both of my keys:

    3072 SHA256:.... <blahblah> (RSA) 2048 SHA256:.... C:\foo\bar\key.ppk (RSA) 

These exact same keys are also used inside WSL2 (Ubuntu 20.04) and they work just fine.

  • When I try to run 'git pull' on any of my BitBucket repos I get the following error:

     permission denied (public key)' 

The exact same command works fine in Ubuntu 20.04 with the exact same keys loaded in 'ssh-agent'. What gives?

1 Answer 1

4

Turned out that 'git' has some sort of pet-peeve with BitBucket when it comes to using its built-in OpenSSH libraries in Windows10.

I resorted to reinstalling 'git' altogether but this time around I made sure to have git employ the OpenSSH suite provided by Windows10 itself (instead of git's built-in OpenSSH suite) and once that was done everything started working as intended.

PS: People more knowledgeable on OpenSSH / BitBucket / Git can shed some more light as to why the built-in 'OpenSSH' suite doesn't work - such things lay outside the realms of my capabilities for the time being.

Git installation

PS#2: if you want to avoid reinstalling 'git' just to tweak this particular setting then you can simply try (haven't tested it myself though):

 git config --global core.sshCommand "'C:\\Windows\\System32\\OpenSSH\\ssh.exe'" 

Bear in mind that in Windows those escaping-backslashes '' are not "exact science" and you have to inspect the resulting entry in your global gitconfig after you run this command. Takes some trial and error to get the path right.

3
  • 2
    The git config value appears to be parsed twice for some reason; I had to edit the line in .gitconfig manually to be sshCommand = "C:\\\\Program\\ Files\\\\OpenSSH-Win64\\\\ssh.exe" Commented Jan 18, 2023 at 14:56
  • 1
    Using git config --global fixed my issue, thanks. Very poorly documented/explained on github and everywhere else I looked for answers. Commented Feb 15 at 21:37
  • That's true, and installing Git from command line does not prompt you all options. Commented Aug 9 at 3:03

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.