【问题标题】:Permission denied when Pushing to Bitbucket after Sierra UpdateSierra 更新后推送到 Bitbucket 时权限被拒绝
【发布时间】:2017-06-01 16:24:25
【问题描述】:

我想推送我对 Bitbucket 所做的一些更改。在我进行 macOS Sierra 更新之前,这一直很好。

现在,我得到了错误(Pushing in SourceTree)

请确保您拥有正确的访问权限和存储库 存在。推送到 ssh://git@bitbucket.xxx.xx:xxx/xxx/xxxx.git 权限被拒绝(公钥)。致命:无法从远程读取 存储库。

我的钥匙还在。但是认证是不可能的。 当我在控制台中输入ssh -vT git@bitbucket.com 并说“是”时,它会尝试三个私钥并打印

没有更多的身份验证方法可以尝试。

权限被拒绝(公钥)

知道为什么会发生这种情况以及如何解决吗?

更新 ssh -vT git@bitbucket.com的输出:

OpenSSH_7.3p1, LibreSSL 2.4.1
debug1: Reading configuration data /Users/corinna/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 20: Applying options for *
debug1: Connecting to bitbucket.com [104.192.143.7] port 22.
debug1: Connection established.
debug1: identity file /Users/corinna/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/corinna/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/corinna/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/corinna/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/corinna/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/corinna/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/corinna/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/corinna/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.3
debug1: Remote protocol version 2.0, remote software version conker_1.0.268-723a194 app-127
debug1: no match: conker_1.0.268-723a194 app-127
debug1: Authenticating to bitbucket.com:22 as 'git'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256@libssh.org
debug1: kex: host key algorithm: ssh-rsa
debug1: kex: server->client cipher: aes128-ctr MAC: hmac-sha2-256 compression: none
debug1: kex: client->server cipher: aes128-ctr MAC: hmac-sha2-256 compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ssh-rsa [many cryptical characters here]
debug1: Host 'bitbucket.com' is known and matches the RSA host key.
debug1: Found key in /Users/corinna/.ssh/known_hosts:4
debug1: rekey after 4294967296 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: rekey after 4294967296 blocks
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /Users/corinna/.ssh/id_rsa
debug1: Authentications that can continue: publickey
debug1: Trying private key: /Users/corinna/.ssh/id_dsa
debug1: Trying private key: /Users/corinna/.ssh/id_ecdsa
debug1: Trying private key: /Users/corinna/.ssh/id_ed25519
debug1: No more authentication methods to try.
Permission denied (publickey).

【问题讨论】:

    标签: git ssh bitbucket sourcetree


    【解决方案1】:

    Sierra 对 ssh-agent 的工作方式进行了一些更改。尝试将此添加到~/.ssh/config

    AddKeysToAgent yes
    

    【讨论】:

    • 感谢您的回答!我的配置文件现在看起来像这样:Host bitbucket.org IdentityFile ~/.ssh/id_rsa AddKeysToAgent yes 但错误仍然存​​在......
    • 我不确定它是在Host 部分下工作还是仅在文件顶部工作。不过,您可以使用 ssh-add 手动添加您的 bitbucket 密钥来测试这是否是问题所在。此设置所做的只是为您自动将密钥添加到代理中。
    • $ ssh add 说“添加了身份 [path]/.ssh/id_rsa”。不幸的是,该许可仍然被拒绝。与AddKeysToAgent的位置变化相同
    • 你能用ssh -v git@bitbucket.com 的输出更新你的问题吗(或者你的远程主机名实际上是什么)?而且我假设您已经验证了本地密钥中的密钥指纹和 bitbucket 网站上的指纹匹配?
    • 我的本地密钥指纹有 50 个字符(通过 ssh-keygen -lf ~/.ssh/id_rsa.pub 获得)。 Bitbucket 密钥要长得多...
    猜你喜欢
    • 2011-12-24
    • 2013-01-17
    • 2018-03-11
    • 1970-01-01
    • 1970-01-01
    • 2016-05-01
    • 2018-06-07
    • 2020-12-30
    • 2018-08-24
    相关资源
    最近更新 更多