【问题标题】:Git authenticate error [duplicate]Git身份验证错误[重复]
【发布时间】:2016-06-07 08:31:25
【问题描述】:

使用命令创建 SSH 密钥:

ssh-keygen.exe -C "my@email.com" -t dsa

输入密码等。文件已创建:C:/Users/MyName/.ssh 中的 id_dsa、id_ds.pub。文件已添加到 git-auth:ssh-add ~/.ssh/id_rsa。现在尝试连接到 git repo: $ ssh -vT -p NNNN ssh://git@some-repo.com

返回错误:

$ ssh -vT -p 52967 ssh://git@some-repo.com.com
OpenSSH_7.1p2, OpenSSL 1.0.2d 9 Jul 2015
debug1: Reading configuration data /c/Users/MyName/.ssh/config
debug1: /c/Users/MyName/.ssh/config line 1: Applying options for *
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to some-repo.com.com [216.70.245.85] port 52967.
debug1: Connection established.
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/MyName/.ssh/id_rsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/MyName/.ssh/id_rsa-cert type -1
debug1: identity file /c/Users/MyName/.ssh/id_dsa type 2
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/MyName/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/MyName/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/MyName/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/MyName/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/MyName/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.9p1 Debian-5ubuntu1.8
debug1: match: OpenSSH_5.9p1 Debian-5ubuntu1.8 pat OpenSSH_5* compat 0x0c000000
debug1: Authenticating to some-repo.com.com:52967 as 'ssh://git'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr umac-64@openssh.com none
debug1: kex: client->server aes128-ctr umac-64@openssh.com none
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ssh-rsa SHA256:Zw5XXi0GgafMm6AhcKnNw+GzqkotZwXZYPWrZogG9KQ
debug1: Host '[some-repo.com.com]:52967' is known and matches the RSA host key.
debug1: Found key in /c/Users/MyName/.ssh/known_hosts:1
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Skipping ssh-dss key /c/Users/MyName/.ssh/id_dsa for not in PubkeyAcceptedKeyTypes
debug1: Trying private key: /c/Users/MyName/.ssh/id_rsa
debug1: Trying private key: /c/Users/MyName/.ssh/id_ecdsa
debug1: Trying private key: /c/Users/MyName/.ssh/id_ed25519
debug1: Next authentication method: password
ssh://git@some-repo.com.com's password:
debug1: Authentications that can continue: publickey,password
Permission denied, please try again.
ssh://git@some-repo.com.com's password:
debug1: Authentications that can continue: publickey,password
Permission denied, please try again.
ssh://git@some-repo.com.com's password:
debug1: Authentications that can continue: publickey,password
debug1: No more authentication methods to try.
Permission denied (publickey,password).

所以它找不到文件/c/Users/MyName/.ssh/id_dsa 但文件存在,我在资源管理器中或通过 ls 命令看到它。可能是什么问题?这是什么意思:

debug1: Skipping ssh-dss key /c/Users/MyName/.ssh/id_dsa for not in PubkeyAcceptedKeyTypes

?

实际上,当我尝试克隆存储库时,我试图通过此命令找出 Git 2.7.1 和 TortoiseGit 的身份验证问题。克隆在 GitExtensions 2.48.05 和旧的 MsysGit 1.9.5 (SSH 6.1) 上工作正常,但在最新的 Git 上失败。

【问题讨论】:

    标签: git authentication ssh windows-7 openssh


    【解决方案1】:

    尝试将您的私钥添加到您正在执行的 ssh 命令中: ssh -vT -p 52967 -i <path_to_your_private_key> ssh://git@some-repo.com.com

    【讨论】:

    • 这不是我要找的。实际上,当我尝试克隆存储库时,使用此命令我试图找出 Git 2.7.1 和 TortoiseGit 的身份验证问题。 GitExtensions 2.48.05 与旧的 MsysGit 1.9.5 (SSH 6.1) 克隆工作正常,但在最新的 Git 上失败。
    【解决方案2】:
    $ ssh -vT -p 52967 ssh://git@some-repo.com.com
    ...
    debug1: Authenticating to some-repo.com.com:52967 as 'ssh://git'
    

    首先,OpenSSH ssh 实用程序在其命令行上不接受 URL。当它将字符串“ssh://git@some-repo.com.com”解析为用户名和主机名时,它将整个字符串“ssh://git”作为用户名。您应该从正在运行的命令中删除“ssh://”:

    ssh -vT -p 52967 git@some-repo.com.com
    

    至于这个错误:

    debug1: Skipping ssh-dss key /c/Users/MyName/.ssh/id_dsa for not in PubkeyAcceptedKeyTypes
    

    您使用的是 SSH 7.1,默认情况下禁用对 DSA 类型密钥的支持。您可以改用 RSA 密钥,或查看 this page 以在您的客户端中重新启用 DSA 密钥支持。简而言之,您可以在本地 ssh 配置文件中添加类似这样的内容:

    Host some-repo.com.com
        KexAlgorithms +diffie-hellman-group1-sha1
    

    【讨论】:

    • 以上解决方案无济于事。实际上,当我尝试克隆存储库时,使用此命令我试图找出 Git 2.7.1 和 TortoiseGit 的身份验证问题。 GitExtensions 2.48.05 与旧的 MsysGit 1.9.5 (SSH 6.1) 克隆工作正常,但在最新的 Git 上失败。
    猜你喜欢
    • 2011-08-22
    • 2021-10-17
    • 1970-01-01
    • 1970-01-01
    • 2018-09-26
    • 2021-01-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多