简体   繁体   English

Bitbucket 权限被拒绝(公钥)。 但适用于 ssh

[英]Bitbucket Permission denied (publickey). but works with ssh

Hello, if i try to connect with bitbucket.org using ssh你好,如果我尝试使用 ssh 连接到 bitbucket.org

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:但是,如果我尝试使用git clone命令,我会收到此消息:

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

Some extra information:一些额外的信息:

  • I already included the public key in my Bitbucket account我已经在我的 Bitbucket 帐户中包含了公钥
  • I have the keys located in ~/.ssh/我的密钥位于~/.ssh/
  • I am not running with sudo我没有用 sudo 运行
  • The command ssh-add -l returns the correct key.命令ssh-add -l返回正确的密钥。 (RSA) (RSA)

I was able to make this work, but there was multiple problems with my git implementation:我能够完成这项工作,但是我的 git 实现存在多个问题:

  • 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.我试图将git clone与模式 USER@bitbucket.org 一起使用,在尝试使用git @bitbucket.org 后一切正常。

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 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.我刚刚在 ssh 配置中添加了两个属性, IdentitiesOnlyPubkeyAcceptedKeyTypes

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 密钥

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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