简体   繁体   中英

Bitbucket Permission denied (publickey). but works with ssh

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

ssh -vT git@bitbucket.org

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:

  • I already included the public key in my Bitbucket account
  • I have the keys located in ~/.ssh/
  • I am not running with sudo
  • The command ssh-add -l returns the correct key. (RSA)

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 USER@bitbucket.org, after trying with git @bitbucket.org everything worked.

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

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

这个答案比公认的答案更能帮助我解决这个确切的问题: Git 在错误的位置寻找我的 SSH 密钥

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM