git - 克隆 Git 存储库时出现 SSH 错误

标签 git ssh

当我尝试使用 SSH 克隆存储库时出现以下错误:

$ git clone ssh://git@stash.mydomain.com:7999/eqt/myproject.git
Cloning into 'myproject'...
Read from socket failed: Connection reset by peer
fatal: Could not read from remote repository.

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

ssh key 存储在共享驱动器中,我可以毫无问题地从另一台也使用共享驱动器的机器执行相同的克隆。我的问题出在我的 Windows 7 笔记本电脑上。

我尝试调试 ssh 连接并运行以下命令:

$ ssh -Tvvv git@stash.mydomain.com -p 7999
OpenSSH_6.6.1, OpenSSL 1.0.1i 6 Aug 2014
debug2: ssh_connect: needpriv 0
debug1: Connecting to stash.mydomain.com [10.105.255.156] port 7999.
debug1: Connection established.
debug3: Incorrect RSA1 identifier
debug3: Could not load "/p/.ssh/id_rsa" as a RSA1 public key
debug1: identity file /p/.ssh/id_rsa type 1
debug1: identity file /p/.ssh/id_rsa-cert type -1
debug1: identity file /p/.ssh/id_dsa type -1
debug1: identity file /p/.ssh/id_dsa-cert type -1
debug1: identity file /p/.ssh/id_ecdsa type -1
debug1: identity file /p/.ssh/id_ecdsa-cert type -1
debug1: identity file /p/.ssh/id_ed25519 type -1
debug1: identity file /p/.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.9.0-ATLASSIAN-1
debug1: no match: SSHD-CORE-0.9.0-ATLASSIAN-1
debug2: fd 3 setting O_NONBLOCK
debug3: put_host_port: [stash.mydomain.com]:7999
debug3: load_hostkeys: loading entries for host "[stash.mydomain.com]:7999" from file "/p/.ssh/known_hosts"
debug3: load_hostkeys: found key type RSA in file /p/.ssh/known_hosts:2
debug3: load_hostkeys: loaded 1 keys
debug3: order_hostkeyalgs: prefer hostkeyalgs: ssh-rsa-cert-v01@openssh.com,ssh-rsa-cert-v00@openssh.com,ssh-rsa
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug2: kex_parse_kexinit: curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-
debug2: kex_parse_kexinit: ssh-rsa-cert-v01@openssh.com,ssh-rsa-cert-v00@openssh.com,ssh-rsa,ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-
stp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519,ssh-dss
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,aes128-cbc,3des-cbc,blowfish-cbc,cast128-c
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,aes128-cbc,3des-cbc,blowfish-cbc,cast128-c
debug2: kex_parse_kexinit: hmac-md5-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-ripemd16
28@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: hmac-md5-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-ripemd16
28@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: none,zlib@openssh.com,zlib
debug2: kex_parse_kexinit: none,zlib@openssh.com,zlib
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit: first_kex_follows 0
debug2: kex_parse_kexinit: reserved 0
debug2: kex_parse_kexinit: diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
debug2: kex_parse_kexinit: ssh-rsa
debug2: kex_parse_kexinit: aes128-ctr,aes128-cbc,3des-cbc,blowfish-cbc
debug2: kex_parse_kexinit: aes128-ctr,aes128-cbc,3des-cbc,blowfish-cbc
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,hmac-md5-96,hmac-sha1-96
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,hmac-md5-96,hmac-sha1-96
debug2: kex_parse_kexinit: none
debug2: kex_parse_kexinit: none
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit: first_kex_follows 0
debug2: kex_parse_kexinit: reserved 0
debug2: mac_setup: setup hmac-md5
debug1: kex: server->client aes128-ctr hmac-md5 none
debug2: mac_setup: setup hmac-md5
debug1: kex: client->server aes128-ctr hmac-md5 none
debug2: bits set: 1008/2048
debug1: sending SSH2_MSG_KEXDH_INIT
debug1: expecting SSH2_MSG_KEXDH_REPLY
Read from socket failed: Connection reset by peer

这可能是什么问题?我的 ssh key 似乎很好,但似乎此连接在某处被阻止。我对 SSH 不够熟悉,不知道去哪里找。

最佳答案

The server can't be the problem though

我仍然会检查 server sshd logs确定 (/var/log/auth.log)(sshd 配置中的 increasing the LogLevel 也有帮助)

您可以尝试通过 MobaXterm 测试 ssh (仅用于测试),因为它有一个 Workaround for "connection reset by peer" issue .

您可以检查它是否是 Cipher issue (on the client side) .

最后,you can try and regenerate a new pair of public/private keys , 在服务器上发布公共(public)的,并检查问题是否仍然存在。

关于git - 克隆 Git 存储库时出现 SSH 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26185665/

相关文章:

git - 相当于 Git 中的 Clearcase 基线和 Clearcase 事件?

wordpress - 使用 gitignore 排除 WordPress 上传文件夹中自动生成的图像大小

git - 何时将大型 Git 存储库拆分为较小的存储库?

git merge-file 因使用 git show 的 bash 进程替换运算符而失败

ssh - 谷歌云平台 : SSH to Google cloud instance will have "Permission denied (publickey)"

git - 在git服务器上找不到推送的仓库

java - 如何使用 SSHJ 通过 SCP 流式传输文件?

ssh - rsync 在管道上通过 SSH 发送时找不到本地目录

linux - 批量编写远程 SSH 命令脚本的最佳方式 (Windows)

ssh - 指纹已被采集 - GIT