Cygwin/Git 错误:检测到 cygheap 基址不匹配

75

我已经安装了两个最新版本的Cygwin和Git的Windows服务器,
现在我想从S1克隆git存储库到S2。
我可以使用RSA密钥从S2成功地进行ssh到S1,但是当我尝试这样做时:

git clone "ssh://root@S1/path/to/my/repo"

它会抛出以下输出:

Cloning into /cygdrive/c/program files/apache software foundation/apache2.2/…
      2 [main] git 2004 C:/cygwin/lib/git-core/git.exe *** fatal error
 - cygheap base mismatch detected - 0x61242860/0x6123790.
This problem is probably due to using incompatible versions of the cygwin DLL.
Search for cygwin1.dll using the Windows Start->Find/Search facility
and delete all but the most recent version.  The most recent version *should*
reside in x:\cygwin\bin, where 'x' is the drive on which you have
installed the cygwin distribution.  Rebooting is also suggested if you
are unable to find another cygwin DLL.

--5 more errors like that one --

remote: Counting objects: 3275, done.
remote: Compressing objects: 100% (3106/3106), done.
    fatal: write error: Broken pipe

我遵循了建议的步骤,但没有成功。 有什么建议吗?


有些人可能会尝试ASLR:https://dev59.com/questions/82kw5IYBdhLWcg3w6ewb#76296598 - T.Todua
16个回答

0
对我来说,问题在于存在一个旧的 C:\cygwin64 文件夹。重命名此文件夹是不够的。当我删除了这个文件夹后,问题就解决了。删除 C:\cygwin64 文件夹后,我也不需要重新启动计算机。

0

0

背景

我之前安装的 Visual Studio 2017 和 2019 版本都能正常工作,但新安装的 Visual Studio 2022 在我的 Windows 10 计算机上使用 Git 出现了问题。

未解决问题的解决方案

  • 重启 Windows。
  • 通过官方安装程序重新安装 Git。
  • 重新安装/更新 Cygwin64。
  • 在系统的 Windows Defender 安全中心中禁用图像强制随机化(强制 ASLR)。
  • 排除 git 可执行文件的 ASLR。
  • 查找并删除较新版本的 cygwin1.dll

实际解决方案

  1. 查找所有 msys-2.0.dll 文件(下面的方法比 Windows Explorer 递归查找文件更快,感谢我以后再说):
dir \msys-2.0.dll /s

注意:正如其他人指出的那样,Git for Windows 实际上使用的是 MSYS 而不是 Cygwin。当 MSYS 团队导入和修改 Cygwin 源代码(source)时,他们忘记更改错误消息。因此,要搜索和删除的实际文件是 msys-2.0.dll,而不是 cygwin1.dll

  1. 删除与您遇到问题的 Visual Studio 版本相关的此文件的出现。例如,如果您只遇到了 Visual Studio 2022 的问题,则只需从以 C:\Program Files\Microsoft Visual Studio\2022\C:\Program Files (x86)\Microsoft Visual Studio\2022\ 开头的路径中删除 msys-2.0.dll
  2. 删除文件夹 C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git
  3. 打开 Visual Studio Installer,-- 您可能已经在计算机上拥有它,因为您已经安装了 Visual Studio,否则,请下载 -- 单击要处理的 Visual Studio 版本的修改,单击个别组件,并在代码工具下选中 Git for Windows 选项。

注意:您的计算机上已安装 Git 并不重要;您仍然需要执行此步骤。

  1. 重新启动计算机。
  2. 完成。

希望这能像对我一样对您有所帮助。


1
这对我来说几乎起作用了,不同的是我没有从..Microsoft Visual Studio..文件夹中删除msys-2.0.dll文件,只是将其重命名为临时名称。 然后按步骤7还原msys-2.0.dll到它们的原始位置。 - akrobet
我按照所有步骤操作了,但只有一个没有msys-2.0.dll文件。问题仍然存在。ASLR解决方案对我也没有用。 - mercury

0
在我的情况下,重新启动电脑并没有起作用。
我最终发现这是由于安装命令行git实用程序时安装的Msys之间的冲突。如果您的系统路径包含任何带有Msys版本的目录,请删除此类路径条目,然后重试。看起来cygwin尝试执行Msys安装中的可执行文件,并且.dll检测到不匹配。

0

我在使用以 #!/bin/sh 开头的脚本从 Visual Studio 2017 推送到 Git 存储库时遇到了相同类型的错误。

[repo folder]\.git\hooks\commit-msg

错误信息:

1 [main] sh (11460) c:\program files (x86)\microsoft visual studio\2017\enterprise\common7\ide\commonextensions\microsoft\teamfoundation\team explorer\Git\usr\bin\sh.exe:
 *** fatal error - cygheap base mismatch detected - 0x14DD408/0x12AD408.This problem is probably due to using incompatible versions of the cygwin DLL.
Search for cygwin1.dll using the Windows Start->Find/Search facilityand delete all but the most recent version.
The most recent version *should*reside in x:\cygwin\bin, where 'x' is the drive on which you haveinstalled the cygwin distribution.
Rebooting is also suggested if youare unable to find another cygwin DLL.      

我尝试了以上不同的解决方案,但都没有成功。

为了解决这个问题,我从以下位置复制了内容:

C:\Program Files\Git\usr\bin

C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git\usr\bin

我的电脑出现问题是由于sh.exe版本不匹配,复制这些文件解决了问题。


0
对我来说,问题出在多个版本的cygwin1.dll上。我只需删除此路径下C:\Users\someone\AppData\Roaming\Microsoft\Windows\Recentcygwin1.dll的链接文件即可解决。以下是错误提示信息。
PS C:\WINDOWS\system32> gdb
      0 [main] iconv (30916) C:\Program Files\Git\usr\bin\iconv.exe: *** fatal error - cygheap base mismatch detected - 0x800000000/0x210351408.
This problem is probably due to using incompatible versions of the cygwin DLL.
Search for cygwin1.dll using the Windows Start->Find/Search facility
and delete all but the most recent version.  The most recent version *should*
reside in x:\cygwin\bin, where 'x' is the drive on which you have
installed the cygwin distribution.  Rebooting is also suggested if you
are unable to find another cygwin DLL.

我使用了everything来查找所有的cygwin1.dll文件,然后注意到了上面的路径。我将其删除并再次进行测试。Bingo。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接