使用命令创建SSH密钥:
ssh-keygen.exe -C "my@email.com" -t dsa
输入密码等。文件已创建:id:_d,id_ds.pub在C:/Users/MyName/.ssh中。文件已添加到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的身份验证问题。使用旧的MsysGit 1.9.5(SSH 6.1),GitExtensions 2.48.05克隆工作正常,但最新的Git失败。
答案 0 :(得分:0)
尝试将您的私钥添加到您正在执行的ssh命令中:
ssh -vT -p 52967 -i <path_to_your_private_key> ssh://git@some-repo.com.com
答案 1 :(得分:0)
$ ssh -vT -p 52967 ssh://git@some-repo.com.com
...
debug1: Authenticating to some-repo.com.com:52967 as 'ssh://git'
首先,OpenSSH ssh
实用程序在其命令行上不接受URL。当它解析字符串&#34; ssh://git@some-repo.com.com"进入用户名和主机名,它取整个字符串&#34; ssh:// git&#34;作为用户名。你应该删除&#34; ssh://&#34;从您正在运行的命令:
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