2

I am trying to add a ssh key to my bitbucket account. I followed the tutorial from https://support.atlassian.com/bitbucket-cloud/docs/set-up-an-ssh-key/ (except that I generate an ed25519 key instead of rsa) and when I run

ssh -T git@bitbucket.org

it returns

ssh: Could not resolve hostname bitbucket.org: No such host is known.

I found that this should be solved by adding the host to the known_hosts file in .ssh folder, but I don't have this file generated.

enter image description here

I also use a vpn and I think this might be a problem, but I don't know how to solve this.

  • "ssh: Could not resolve hostname bitbucket.org: No such host is known." - sounds like a networking issue. Does it work without the VPN being active? – Nico Haase Oct 27 '22 at 16:22
  • yes, it works without VPN, but I followed the steps and tested it on another computer, as on the computer from work I cannot test without the VPN – Vulsan Bianca Oct 27 '22 at 16:43
  • Then you should check the VPN settings. This is not a programming-related issue – Nico Haase Oct 27 '22 at 16:55
  • Ok, I think you are right, I saw on my vpn settings that ipv6 connections are not allowed, but do you know how to force the connection to bitbucket to only use ipv4 on windows? (I found how to do it on linux here: https://stackoverflow.com/questions/42888832/cant-push-pull-to-bitbucket-via-ssh-using-ipv6, but I don't know how to adapt it for windows) – Vulsan Bianca Oct 27 '22 at 18:05

1 Answers1

1

But do you know how to force the connection to Bitbucket to only use ipv4 on Windows?
(I found how to do it on Linux here, but I don't know how to adapt it for Windows)

It should be the same file, with the same content, but in %USERPROFILE%\.ssh\config.
Make sure to create/edit it with LF as EOL in your editor of choice (Notepad++, Visual Studio Code, ...)

Host bitbucket
     HostName bitbucket.org
     User git
     IdentityFile ~/.ssh/id_rsa_bitbucket
     AddressFamily inet

Here, ~ will be interpreted by C:\Program Files\Git\use\bin\ssh.exe as %USERPROFILE%.
Replace id_rsa_bitbucket by the name of the private key you are using to authenticate yourself to Bitbucket.


And don't forget: starting June 2023, the Bitbucket RSA host key will change.
Check your %USERPROFILE%\.ssh\known_hosts file.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250