【问题标题】:SSH Keys, CYGWIN, BitBucket, Permission denied (publickey)SSH 密钥、CYGWIN、BitBucket、权限被拒绝(公钥)
【发布时间】:2014-05-01 16:18:55
【问题描述】:

我正在尝试将初始代码库推送到 bitbucket。我已经生成了密钥,BitBucket 有我的公钥。当我通过 CYGWIN 运行 GIT PUSH 时

push -u origin --all

它只是挂起。

我已经追踪到没有正确处理键的事实(见下文)

当我运行以下内容时

ssh -vT user@bitbucket.org

我得到以下输出...

OpenSSH_6.6.1, OpenSSL 1.0.1g 7 Apr 2014
debug1: Reading configuration data /etc/ssh_config
debug1: Connecting to bitbucket.org [131.103.20.168] port 22.
debug1: Connection established.
debug1: identity file /home/user/.ssh/id_rsa type 1
debug1: identity file /home/user/.ssh/id_rsa-cert type -1
debug1: identity file /home/user/.ssh/id_dsa type -1
debug1: identity file /home/user/.ssh/id_dsa-cert type -1
debug1: identity file /home/user/.ssh/id_ecdsa type -1
debug1: identity file /home/user/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/user/.ssh/id_ed25519 type -1
debug1: identity file /home/user/.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 OpenSSH_5.3
debug1: match: OpenSSH_5.3 pat OpenSSH_5* compat 0x0c000000
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<3072<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/user/.ssh/known_hosts:2
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/user/.ssh/id_rsa
debug1: Authentications that can continue: publickey
debug1: Trying private key: /home/user/.ssh/id_dsa
debug1: Trying private key: /home/user/.ssh/id_ecdsa
debug1: Trying private key: /home/user/.ssh/id_ed25519
debug1: No more authentication methods to try.
Permission denied (publickey).

请注意,最后几行中标识的键在 .ssh 目录中不存在...

debug1: Trying private key: /home/user/.ssh/id_dsa
debug1: Trying private key: /home/user/.ssh/id_ecdsa
debug1: Trying private key: /home/user/.ssh/id_ed25519

有什么想法吗?

【问题讨论】:

    标签: git ssh cygwin


    【解决方案1】:

    ssh -vT user@bitbucket.org 永远不会工作。

    只有git@bitbucket.org 可以工作。

    如“Use the SSH protocol with Bitbucket”中所述,BitBucket 存储库的有效 ssh url 如下所示:

    git@bitbucket.org:accountname/reponame.git
    

    您可以使用以下命令更改远程来源网址:

    cd /path/top/your/repo
    git remote set-url origin git@bitbucket.org:accountname/reponame.git
    

    【讨论】:

      猜你喜欢
      • 2019-10-22
      • 2018-03-11
      • 1970-01-01
      • 1970-01-01
      • 2019-11-24
      • 2014-11-08
      • 2019-03-11
      • 1970-01-01
      • 2015-05-10
      相关资源
      最近更新 更多