Atlassian Stash - 权限被拒绝(公钥)

Atlassian Stash - Permission Denied (publickey)

我实际上正在为我的 Workplace 设置 Atlassian Stash。我已经 运行 解决了这个我无法解决的问题。请注意,这是 运行 Windows 7 64 位安装。

在设置 SSH 密钥时,我按照 Stash 指南了解如何创建它们并将它们设置到我的帐户中。尽管如此,这里遇到的问题并不是真正的字面意思,因为它似乎不接受密钥。 (在 Stash 中创建的两个用户都是管理员,并且对所有回购具有管理员权限。)

在执行简单的克隆命令时,出现此错误:

$ git clone ssh://git@localhost:7999/test/test.git
Cloning into 'test'...
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

我按照 Atlassian 网站文档区中的步骤进行操作,但仍然无法正常工作。

Git Operations Fail - Permission denied - publickey

Permission denied (publickey)

$ ssh -p 7999 -I ~/.ssh/id_rsa -vT git@localhost
OpenSSH_6.6.1, OpenSSL 1.0.1m 19 Mar 2015
debug1: Connecting to localhost [127.0.0.1] port 7999.
debug1: Connection established.
dlopen /c/Users/Webit-Alex/.ssh/id_rsa failed: dlopen: Win32 error 126
debug1: identity file /c/Users/Webit-Alex/.ssh/id_rsa type 1
debug1: identity file /c/Users/Webit-Alex/.ssh/id_rsa-cert type -1
debug1: identity file /c/Users/Webit-Alex/.ssh/id_dsa type -1
debug1: identity file /c/Users/Webit-Alex/.ssh/id_dsa-cert type -1
debug1: identity file /c/Users/Webit-Alex/.ssh/id_ecdsa type -1
debug1: identity file /c/Users/Webit-Alex/.ssh/id_ecdsa-cert type -1
debug1: identity file /c/Users/Webit-Alex/.ssh/id_ed25519 type -1
debug1: identity file /c/Users/Webit-Alex/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.6.1
debug1: Remote protocol version 2.0, remote software version SSHD-CORE-0.14.0
debug1: no match: SSHD-CORE-0.14.0
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: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: RSA 0e:58:0e:af:a8:a1:35:5b:5e:3c:ac:8a:50:af:13:a9
debug1: Host '[localhost]:7999' is known and matches the RSA host key.
debug1: Found key in /c/Users/Webit-Alex/.ssh/known_hosts:1
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: /c/Users/Webit-Alex/.ssh/id_rsa
debug1: Authentications that can continue: publickey
debug1: Trying private key: /c/Users/Webit-Alex/.ssh/id_dsa
debug1: Trying private key: /c/Users/Webit-Alex/.ssh/id_ecdsa
debug1: Trying private key: /c/Users/Webit-Alex/.ssh/id_ed25519
debug1: No more authentication methods to try.
Permission denied (publickey).

是否有人有解决方案或愿意帮助 Stash 正常工作?

检查 /var/log/auth.logjournalctl -u sshd 以获取任何信息,例如密钥文件的无效权限。另一个常见的错误也是 authorized_keys.

上的错字

我遇到了同样的问题,但试图访问远程主机而不是本地主机。奇怪的是它在前一天晚上工作得很好。我得到了与原始海报完全相同的错误。最后,我删除了存储服务器上的所有 SSH 密钥,并重新添加了之前的 id_rsa.pub 密钥。我又试了一次,效果很好。我的 SSH 密钥在存储服务器上损坏或存储服务器无法加载我的密钥 - 无论哪种方式重新添加它都解决了问题。

检查您的 ssh 密钥是否在 /.ssh/id_rsa/.ssh/id_rsa.pub 中,有时它可能会消失或出现其他问题。

您可以使用 this instruction

更新和重置 ssh 密钥