Kauê Gimenes
Kauê Gimenes

Reputation: 1286

Bitbucket Permission denied (publickey). but works with ssh

Hello, if i try to connect with bitbucket.org using ssh

ssh -vT [email protected]

Everything works fine

debug1: Authentication succeeded (publickey).

But if i try to use the git clone command i recive this message:

Permission denied (publickey).
fatal: The remote end hung up unexpectedly

Some extra information:

Upvotes: 3

Views: 14765

Answers (5)

Ben
Ben

Reputation: 104

The example mentioned in atlassian support site was using Ed25519 key with 4096 bits. I could resolve this permission denied(publickey) by switching to RSA.

Generate the ssh key as - ssh-keygen -t rsa -C [email protected]

Upvotes: 0

DS2540
DS2540

Reputation: 1

Start the ssh agent if it is not set up to run automatically by running following command on powershell (run as administrator)

Start-Service ssh-agent

Upvotes: 0

Glend Maatita
Glend Maatita

Reputation: 633

I found similiar problem and the solution is here

https://confluence.atlassian.com/bitbucketserverkb/ssh-rsa-key-rejected-with-message-no-mutual-signature-algorithm-1026057701.html

I just added two properties, IdentitiesOnly and PubkeyAcceptedKeyTypes in ssh config.

Host bitbucket.org
    HostName bitbucket.org
    IdentityFile /home/me/.ssh/id_rsa_bitbucket
    IdentitiesOnly yes
    PubkeyAcceptedKeyTypes +ssh-rsa

Please note that there is security concern regarding this solution as mentioned in the link above

Upvotes: 5

Hakaishin
Hakaishin

Reputation: 2932

This answer helped me more for this exact problem, than the accepted answer: Git looking for my SSH key in the wrong location

Upvotes: 1

Kauê Gimenes
Kauê Gimenes

Reputation: 1286

I was able to make this work, but there was multiple problems with my git implementation:

  • I was trying to access a organization repository but i added the public key to my main account.
  • I was trying to use git clone with the pattern [email protected], after trying with git@bitbucket.org everything worked.

I hope this helps someone with the same problem i had.

Upvotes: 2

Related Questions