简体   繁体   English

BitBucket-Git-权限被拒绝(公钥)

[英]BitBucket - Git - Permission denied (publickey)

First of all, I would like you to know that I have read thoroughly 20+ posts on the topic. 首先,我想让你知道我已经阅读了20多个关于该主题的文章。 However, it is still not working after 2 days, so... I finally give up and acknowledge that I CANNOT set up this ssh connection... 但是,两天后它仍然无法工作,所以...我终于放弃了,并承认我无法建立此ssh连接...

Ok, painful enough. 好,够痛苦的 Now here is what I did (at least 3 times) : 现在这是我所做的(至少3次):

  1. I generate a set of ssh keys with the command : 我使用以下命令生成一组ssh密钥:

     ssh-keygen -t rsa 
  2. Here are the permissions for both the .ssh folder and the rsa keys : 这是.ssh文件夹和rsa keys的权限:

     $ ls -al | grep .ssh drwx------ 2 local local 4096 mars 28 11:17 .ssh $ ls -al .ssh/ -rw-r--r-- 1 local local 802 mars 11 17:11 authorized_keys -rw-r--r-- 1 local local 61 mars 28 11:17 config -rw------- 1 local local 1675 mars 28 11:14 id_rsa -rw------- 1 local local 396 mars 28 11:14 id_rsa.pub -rw------- 1 local local 1326 mars 25 17:38 known_hosts 
  3. I copied the content of id_rsa_.pub to my BitBucket account. 我将id_rsa_.pub的内容复制到了我的BitBucket帐户中。 I am sure this is done flawlessly, I triple checked. 我确信这是完美无缺的,我三重检查。

  4. I edited .ssh/config so it looks like this : 我编辑了.ssh/config ,它看起来像这样:

     $ cat .ssh/config Host bitbucket.org IdentityFile /home/local/.ssh/id_rsa.pub 
  5. And here is the output of ssh -v git@bitbucket.org : 这是ssh -v git@bitbucket.org的输出:

     $ ssh -v git@bitbucket.org OpenSSH_6.0p1 Debian-4+deb7u2, OpenSSL 1.0.1e 11 Feb 2013 debug1: Reading configuration data /home/local/.ssh/config debug1: /home/local/.ssh/config line 1: Applying options for bitbucket.org debug1: Reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 19: Applying options for * debug1: Connecting to bitbucket.org [131.103.20.168] port 22. debug1: Connection established. debug1: identity file /home/local/.ssh/id_rsa.pub type 1 debug1: Checking blacklist file /usr/share/ssh/blacklist.RSA-2048 debug1: Checking blacklist file /etc/ssh/blacklist.RSA-2048 debug1: identity file /home/local/.ssh/id_rsa.pub-cert type -1 debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3 debug1: match: OpenSSH_5.3 pat OpenSSH_5* debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_6.0p1 Debian-4+deb7u2 debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug1: kex: server->client aes128-ctr hmac-md5 none debug1: kex: client->server aes128-ctr hmac-md5 none debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP debug1: SSH2_MSG_KEX_DH_GEX_INIT sent debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY debug1: Server host key: RSA 97:8c:1b:f2:6f:14:6b:5c:3b:ec:aa:46:46:74:7c:40 debug1: Host 'bitbucket.org' is known and matches the RSA host key. debug1: Found key in /home/local/.ssh/known_hosts:3 debug1: ssh_rsa_verify: signature correct debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug1: SSH2_MSG_NEWKEYS received debug1: Roaming not allowed by server debug1: SSH2_MSG_SERVICE_REQUEST sent debug1: SSH2_MSG_SERVICE_ACCEPT received debug1: Authentications that can continue: publickey debug1: Next authentication method: publickey debug1: Offering RSA public key: /home/local/.ssh/id_rsa.pub debug1: Remote: Forced command: conq username:happy-dev debug1: Remote: Port forwarding disabled. debug1: Remote: X11 forwarding disabled. debug1: Remote: Agent forwarding disabled. debug1: Remote: Pty allocation disabled. debug1: Server accepts key: pkalg ssh-rsa blen 279 debug1: key_parse_private_pem: PEM_read_PrivateKey failed debug1: read PEM private key done: type <unknown> Enter passphrase for key '/home/local/.ssh/id_rsa.pub': debug1: No more authentication methods to try. Permission denied (publickey). 

If you have any idea why I still get the Permission denied (publickey) message, please do share it with me. 如果您知道为什么我仍然收到“ Permission denied (publickey)消息,请与我分享。 I am in great despair :D 我非常绝望:D

IdentityFile /home/local/.ssh/id_rsa.pub

You're using the public key file here. 您在此处使用公共密钥文件。 You should use the private key file instead. 您应该改用私钥文件。 It's probably called id_rsa : 它可能叫做id_rsa

IdentityFile /home/local/.ssh/id_rsa

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

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