gpt4 book ai didi

Git push over ssh 在 Windows 上失败,错误为 'the remote end hung up unexpectedly'

转载 作者:行者123 更新时间:2023-12-02 13:45:43 26 4
gpt4 key购买 nike

我希望有人可以帮助我,因为我已经为此奋斗了好几天,并且被难住了。我已经在运行 Windows 10 的全新笔记本电脑上设置了标准 git 客户端(来自 git-scm.com),并且正在处理 Github.com 上托管的存储库。

最初,由于本地 Windows OpenSSH 客户端与 git 附带的捆绑 SSH 客户端发生冲突,我在 SSH 配置中遇到了一些冲突。所以身份验证失败。这个,我设法通过明确设置全局 sshCommand 来解决。配置值根据 Adam Ralph's suggestion .这让我解决了身份验证问题,我可以很好地从 GitHub 克隆、获取和 pull 数据。但是,当我尝试推送时,我没有遇到以下错误。

Counting objects: 15, done.
Delta compression using up to 12 threads.
Compressing objects: 100% (11/11), done.
Writing objects: 100% (15/15), 3.20 KiB | 252.00 KiB/s, done.
Total 15 (delta 1), reused 0 (delta 0)
Connection to github.com closed by remote host.
fatal: The remote end hung up unexpectedly
fatal: The remote end hung up unexpectedly

我一直在搜索 google 和 stackoverflow,并尝试了我能找到的所有解决方案:
  • 设置 http.postbuffer值为 500MB - 1GB(虽然我的 repo 没有大文件,只有一些小的 typescript 文件)
  • 完全卸载Windows自带的OpenSSH客户端
  • 安装各种版本的Git客户端2.17.1、2.19.2、2.20.1(当前最新版本)
  • 通过尝试相同的操作进行了一些完整性检查 git push在运行 Windows 10 专业版、具有相同存储库的其他几台计算机上添加/更改相同文件子集的命令
  • 重新安装 git 客户端,禁用 LFS 支持,然后运行 ​​git filter-branch在 repo 上清理 repo
  • 尝试多次将 repo 重新克隆到新文件夹
  • 尝试改用 HTTPS 而不是 SSH。这似乎是取消阻止推送到我的 GitHub 存储库的唯一方法
  • 通过将 sshCommand 设置为 ssh -vv 来打开更详细的日志记录.这会更新控制台日志记录以阻止下面的内容。

  • 在这一点上,我可以通过切换到 HTTPS 远程连接来解除对实际工作的阻止,但是在我使用 git 的几年中,我从未在使用 SSH 时遇到过这样的问题。有没有人遇到过这样的事情?有什么明显的我遗漏了。
    OpenSSH_7.7p1, OpenSSL 1.0.2o  27 Mar 2018
    debug1: Reading configuration data /etc/ssh/ssh_config
    debug2: resolving "github.com" port 22
    debug2: ssh_connect_direct: needpriv 0
    debug1: Connecting to github.com [192.30.253.112] port 22.
    debug1: Connection established.
    debug1: identity file /c/Users/John/.ssh/id_rsa type 0
    debug1: key_load_public: No such file or directory
    debug1: identity file /c/Users/John/.ssh/id_rsa-cert type -1
    debug1: key_load_public: No such file or directory
    debug1: identity file /c/Users/John/.ssh/id_dsa type -1
    debug1: key_load_public: No such file or directory
    debug1: identity file /c/Users/John/.ssh/id_dsa-cert type -1
    debug1: key_load_public: No such file or directory
    debug1: identity file /c/Users/John/.ssh/id_ecdsa type -1
    debug1: key_load_public: No such file or directory
    debug1: identity file /c/Users/John/.ssh/id_ecdsa-cert type -1
    debug1: key_load_public: No such file or directory
    debug1: identity file /c/Users/John/.ssh/id_ed25519 type -1
    debug1: key_load_public: No such file or directory
    debug1: identity file /c/Users/John/.ssh/id_ed25519-cert type -1
    debug1: key_load_public: No such file or directory
    debug1: identity file /c/Users/John/.ssh/id_xmss type -1
    debug1: key_load_public: No such file or directory
    debug1: identity file /c/Users/John/.ssh/id_xmss-cert type -1
    debug1: Local version string SSH-2.0-OpenSSH_7.7
    debug1: Remote protocol version 2.0, remote software version babeld-f43b814b
    debug1: no match: babeld-f43b814b
    debug2: fd 3 setting O_NONBLOCK
    debug1: Authenticating to github.com:22 as 'git'
    debug1: SSH2_MSG_KEXINIT sent
    debug1: SSH2_MSG_KEXINIT received
    debug2: local client KEXINIT proposal
    debug2: KEX algorithms: curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1,ext-info-c
    debug2: host key algorithms: ssh-rsa-cert-v01@openssh.com,rsa-sha2-512,rsa-sha2-256,ssh-rsa,ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ssh-ed25519-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519
    debug2: ciphers ctos: aes128-ctr,aes192-ctr,aes256-ctr,aes128-cbc,3des-cbc,aes256-cbc,aes192-cbc
    debug2: ciphers stoc: aes128-ctr,aes192-ctr,aes256-ctr,aes128-cbc,3des-cbc,aes256-cbc,aes192-cbc
    debug2: MACs ctos: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
    debug2: MACs stoc: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
    debug2: compression ctos: none,zlib@openssh.com,zlib
    debug2: compression stoc: none,zlib@openssh.com,zlib
    debug2: languages ctos:
    debug2: languages stoc:
    debug2: first_kex_follows 0
    debug2: reserved 0
    debug2: peer server KEXINIT proposal
    debug2: KEX algorithms: curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256
    debug2: host key algorithms: ssh-dss,ssh-rsa
    debug2: ciphers ctos: chacha20-poly1305@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc
    debug2: ciphers stoc: chacha20-poly1305@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc
    debug2: MACs ctos: hmac-sha2-256,hmac-sha2-512,hmac-sha1
    debug2: MACs stoc: hmac-sha2-256,hmac-sha2-512,hmac-sha1
    debug2: compression ctos: none,zlib,zlib@openssh.com
    debug2: compression stoc: none,zlib,zlib@openssh.com
    debug2: languages ctos:
    debug2: languages stoc:
    debug2: first_kex_follows 0
    debug2: reserved 0
    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 SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8
    debug1: Host 'github.com' is known and matches the RSA host key.
    debug1: Found key in /c/Users/John/.ssh/known_hosts:1
    debug2: set_newkeys: mode 1
    debug1: rekey after 4294967296 blocks
    debug1: SSH2_MSG_NEWKEYS sent
    debug1: expecting SSH2_MSG_NEWKEYS
    debug1: SSH2_MSG_NEWKEYS received
    debug2: set_newkeys: mode 0
    debug1: rekey after 4294967296 blocks
    debug2: key: /c/Users/John/.ssh/id_rsa (0x600061250)
    debug2: key: /c/Users/John/.ssh/id_dsa (0x0)
    debug2: key: /c/Users/John/.ssh/id_ecdsa (0x0)
    debug2: key: /c/Users/John/.ssh/id_ed25519 (0x0)
    debug2: key: /c/Users/John/.ssh/id_xmss (0x0)
    debug2: service_accept: ssh-userauth
    debug1: SSH2_MSG_SERVICE_ACCEPT received
    debug1: Authentications that can continue: publickey
    debug1: Next authentication method: publickey
    debug1: Offering public key: RSA SHA256:0imySt9BYYbsr5CLqXP5JRHwHNCXAYuotf8/6WGE4sU /c/Users/John/.ssh/id_rsa
    debug2: we sent a publickey packet, wait for reply
    debug1: Server accepts key: pkalg ssh-rsa blen 535
    debug2: input_userauth_pk_ok: fp SHA256:0imySt9BYYbsr5CLqXP5JRHwHNCXAYuotf8/6WGE4sU
    debug1: Authentication succeeded (publickey).
    Authenticated to github.com ([192.30.253.112]:22).
    debug2: fd 4 setting O_NONBLOCK
    debug2: fd 5 setting O_NONBLOCK
    debug1: channel 0: new [client-session]
    debug2: channel 0: send open
    debug1: Entering interactive session.
    debug1: pledge: network
    debug2: channel_input_open_confirmation: channel 0: callback start
    debug2: fd 3 setting TCP_NODELAY
    debug2: client_session2_setup: id 0
    debug1: Sending command: git-receive-pack 'john-shaskin/polly-notes-reader.git'
    debug2: channel 0: request exec confirm 1
    debug2: channel_input_open_confirmation: channel 0: callback done
    debug2: channel 0: open confirm rwindow 32000 rmax 35000
    debug2: channel_input_status_confirm: type 99 id 0
    debug2: exec request accepted on channel 0
    Counting objects: 15, done.
    Delta compression using up to 12 threads.
    Compressing objects: 100% (11/11), done.
    Writing objects: 13% (2/15) 1248163Writing objects: 6% (1/15)
    Writing objects: 100% (15/15), 3.20debug2: channel 0: read<=0 rfd 4 len 0 KiB | 192.00 KiB/s, done.
    Total 15 (delta 1), reused 0 (delta 0)
    debug2: channel 0: read failed
    debug2: channel 0: close_read
    debug2: channel 0: input open -> drain
    debug2: channel 0: ibuf empty
    debug2: channel 0: send eof
    debug2: channel 0: input drain -> closed
    debug2: channel 0: rcvd eof
    debug2: channel 0: output open -> drain
    debug2: channel 0: obuf empty
    debug2: channel 0: close_write
    pectedlychannel 0: output drain -> closedfatal: The remote end hung up unexpectedly
    fatal: The remote end hung up unex
    debug1: channel 0: free: client-session, nchannels 1
    Connection to github.com closed by remote host.
    Transferred: sent 6880, received 2096 bytes, in 0.5 seconds
    Bytes per second: sent 13415.2, received 4087.0
    debug1: Exit status -1

    最佳答案

    This, I've managed to solve by explicitly setting the global sshCommand config value as per Adam Ralph's suggestion.



    是的,但不是:首先尝试在 CMD session 中使用 Git,您已经在其中放置了一个简化的 PATH,其中 Git 捆绑的 openSSH 将首先出现并被使用(OpenSSH_8.2p1,OpenSSL 1.1.1d 2019 年 9 月 10 日)来自 Windows 的旧版本
    set PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\
    set GH=C:\path\to\git
    set PATH=%GH%\bin;%GH%\usr\bin;%GH%\mingw64\bin;%PATH%

    git config --gobal --unset core.sshCommand
    cd C:\path\to\repo
    git config --local --unset core.sshCommand

    然后在该 CMD session 中重试,以测试 SSH 问题是否仍然存在。

    关于Git push over ssh 在 Windows 上失败,错误为 'the remote end hung up unexpectedly',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53797428/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com