Connection to bitbucket using ssh keys can't be established

906 Views Asked by At

To be able to connect to my repositories in Bitbucket I did the following steps:

  1. Executed (Windows 11 Powershell as admin): ssh-keygen -t ed25519 -b 4096 -C "[email protected]". Public and private keys (id_ed25519 and id_ed25519.pub) have been created in C:\Users\myusername\.ssh
  2. In bitbucket I've added these keys: "My Repository" -> "Repository Settings" -> "SSH Keys"
  3. I've started the ssh-agent: Start-Service ssh-agent
  4. I've added the new ssh key to the ssh-agent: ssh-add C:\Users\myusername\.ssh\id_ed25519
  5. I checked the key with: ssh-add -l. Looks good.
  6. I tested the connection to bitbucket with: ssh [email protected].

In the final step, I received the following error message: [email protected]: Permission denied (publickey).

Is there anything missing or wrong in the steps above?

1

There are 1 best solutions below

7
Klaus On

That's not the right way doing it, @clex. That's why you're receiving a message saying that your private key will be ignored

You should add only a public key to bitbucket and use a private key on your ssh-agent to authenticate.