【问题标题】:Ubuntu wsl2 git getting "The remote end hung up unexpectedly" on large reposUbuntu wsl2 git 在大型存储库上得到“远程端意外挂断”
【发布时间】:2019-07-09 06:16:07
【问题描述】:

在 Windows 上的 wsl2 中的 Ubuntu 19.04 中执行此操作数天。

$ git clone https://github.com/gohugoio/hugo.git
Cloning into 'hugo'...
error: RPC failed; curl 56 GnuTLS recv error (-12): A TLS fatal alert has been received.
fatal: The remote end hung up unexpectedly
  • 我尝试重新编译 git 以使用 openssl,但没有做任何事情。
  • 我尝试了 ssh 和 https。
  • 我尝试修改 http 的 git 设置。
  • 我修改了各种git内存设置。
  • 目前 Stack Overflow 上的任何内容都无法解决此问题。
  • 我完全重新安装了 Windows。不,仍然冲洗。

四天的威士忌探戈狐步舞……然后我找到了。

【问题讨论】:

  • 如此多的线程和解决方案似乎试图通过 git 配置解决问题,但如果没有正确的驱动程序,它们都无法工作。

标签: windows git ssl windows-subsystem-for-linux gnutls


【解决方案1】:

最新的 Windows Hyper-V 与您的 wifi 驱动程序存在问题。你需要从https://downloadcenter.intel.com/download/28876/Windows-10-Wi-Fi-Drivers-for-Intel-Wireless-Adapters?v=t获取最新消息

一旦安装了新的驱动程序,您会惊叹于 wsl2 中的 git 是如何完全做到它应该做的。我永远不会回到我生命中的那5天。我希望这能让您避免失去 5 天的时间。

这里是问题:https://github.com/microsoft/WSL/issues/4253

【讨论】:

  • 这也解决了我在安装 conda 包时遇到的问题,特别是错误“CondaHTTPError: HTTP 000 CONNECTION FAILED”。
  • 这花了我 3 天的时间,谢谢你救了另外两个! :-)
  • 经过一天的挖掘终于找到了这个。谢谢你救了我另外 4 个。
【解决方案2】:

2020 年 11 月更新:WSL2 4253 上的最新 cmets 指出:

将 MTU 设置为 1350(与 VPN 接口相同):

sudo ifconfig eth0 mtu 1350
# or
ip link set dev eth0 mtu 1350

检查您的 MTU:

PS C:\> netsh interface ipv4 show subinterface

   MTU  MediaSenseState   Bytes In  Bytes Out  Interface
------  ---------------  ---------  ---------  -------------
4294967295                1          0     117945  Loopback Pseudo-Interface 1
  1500                1  879583365  308029141  Wi-Fi
...
  1500                1    3616963    2778319  vEthernet (WSL)

vs.

➜ ip addr | grep mtu
5: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000

可能需要Windows 10 build 20231 来确保issue 5821 "WSL vEthernet adapter shows up as disconnected" 是固定的。


B. Agustín Amenábar Larraín explains:

在这个问题之前,我从未听说过 MTU,而且我很难相信这是原因,的确如此。

  • 我在连接 Pulse Secure VPN 时遇到问题,我正在尝试连接到内部自托管 Gitlab。
  • 到常规互联网的 SSH 流量正常。
  • 我使用的是 WSL2 Ubuntu 20.04,如果我将它放到 WSL1 中,一切都按预期工作(对于 Debian 也是如此)。

尝试先升级你的驱动程序,这对我不起作用。

首先打开一个 PowerShell 提示符并输入:

netsh interface ipv4 show subinterface

你会得到如下输出:

  MTU  MediaSenseState   Bytes In  Bytes Out  Interface
------  ---------------  ---------  ---------  -------------
4294967295                1          0    5974969  Loopback Pseudo-Interface 1
 1500                1  2678641808  213293706  Wi-Fi
 1500                5          0          0  Local Area Connection* 1
 1500                5          0          0  Local Area Connection* 2
 1500                1          0     529702  vEthernet (Default Switch)
 1300                1       2106     509236  vEthernet (WSL)
 1200                1  553027168   20290571  Local Area Connection* 13
 1500                1          0   22759124  VirtualBox Host-Only Network #3
 1500                5          0          0  Bluetooth Network Connection 4

密钥在Local Area Connection 13 MTU*(名称和值可以在机器之间更改),即VPN接口。就我而言,它是 1200,这就是原因

set MTU to 1350 (same as VPN interface):
sudo ifconfig eth0 mtu 1350

对我不起作用...而且我不知道如何获取 VPN 接口 MTU。

(我也讨厌安装ifconfig,它已被ip 弃用)。

现在我们知道了,您可以在具有提升权限的 PowerShell 中从 Windows 更改 VPN MTU,

netsh interface ipv4 set subinterface "Local Area Connection* 13" mtu=1400 store=persistent

如果您想跳过下一步,可以将其设置为 1500,但您没有为 VPN 包装数据包留下空间,例如我在使用 Github 时遇到了问题,因为将其设置为 1500。

然后,在您的 WSL2 发行版中,您可以通过以下方式检查您当前的 MTU 值:

❯ ip addr | grep mtu
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
2: bond0: <BROADCAST,MULTICAST,MASTER> mtu 1500 qdisc noop state DOWN group default qlen 1000
3: dummy0: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN group default qlen 1000
4: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
5: sit0@NONE: <NOARP> mtu 1480 qdisc noop state DOWN group default qlen 1000

我们关心 eth0(与 Windows 的虚拟以太网连接),您必须将匹配的 MTU 设置为您在上一步中离开的位置。

sudo ip link set eth0 mtu 1400

遗憾的是,每次您启动新的 VPN 会话、重新启动 WSL2,甚至从 WLAN 切换到 LAN 时,这两个设置都会被重置。

Leonardo Oliveira adds:

您的问题解决方案与我的类似,但是我将 WSL2 内部的以太网 MTU 更改为我在 windows power shell (Ethernet WSL) 中看到的相同编号,这样对我有用。

【讨论】:

    猜你喜欢
    • 2011-10-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-04-23
    • 2013-02-20
    • 1970-01-01
    • 2012-08-19
    相关资源
    最近更新 更多