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

发布于 2024-12-15 07:38:23 字数 1041 浏览 1 评论 0原文

我已经安装了两台 Windows 服务器以及最新版本的 Cygwin 和 Git,
我正在尝试将 git 存储库从 S1 克隆到 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

所以我按照建议的说明进行操作,但没有运气。 有什么建议吗?

I have installed two Windows servers with the latest versions of Cygwin and Git,
and I am trying to clone the git repository from S1 to S2.
I can successfully ssh from S2 to S1 using RSA keys, but when I do this :

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

it throws back this output:

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

So I followed the suggested instructions, but no luck.
Any suggestions?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(16

深者入戏 2024-12-22 07:38:23

我也有同样的问题。

我刚刚重新启动我的电脑,它又恢复正常了。

它无助于找到问题的原因,但至少你可以继续工作。

I had the same problem.

I just restarted my PC and it worked again.

It doesn't help to find reason of problem but at least you can keep on to work.

陪我终i 2024-12-22 07:38:23

cygwin/git 可能会受到 ASLR 的影响

在我的例子中,一个名为地址空间布局随机化 (ASLR) 的 Windows 安全功能造成了这个问题。对于不标记自身兼容的程序,ASLR 应默认关闭(更多信息)。
我还没有检查 cygwin/git 二进制文件的标头中是否有此标志,但我确实为所有应用程序手动启用了 ASLR 作为额外的安全措施。事实证明,这使得 git 命令停止工作。

解决方案

解决方案是排除 git 可执行文件的 ASLR。因为它们有很多,我不得不使用 PowerShell 作为 < em>管理员:

Get-Item -Path "C:\Program Files\Git\usr\bin\*.exe" | %{ Set-ProcessMitigation -Name $_.Name -Disable ForceRelocateImages }

cygwin/git can be impacted by ASLR

In my case a Windows security feature called Address Space Layout Randomization (ASLR) had created this problem. ASLR should be off by default for programs that do not mark themselves compatible (more info).
I haven't checked if cygwin/git binaries had this flag in their headers, but I did have ASLR manually enabled for all apps as an extra security measure. As it had turned out, this made git commands stop working.

Solution

The solution was to exclude ASLR for git executables. Because there're quite many of them, I had to use PowerShell as administrator:

Get-Item -Path "C:\Program Files\Git\usr\bin\*.exe" | %{ Set-ProcessMitigation -Name $_.Name -Disable ForceRelocateImages }
绅士风度i 2024-12-22 07:38:23

编辑:我找到了解决方案。

TL;DR: 转到 GitHub AppData 文件夹并删除 PortableGit 文件夹,然后重新启动 GitHub

  1. 关闭 GitHub
  2. 导航到 GitHub AppData 文件夹:
    C:\Users\[用户名]\AppData\Local\GitHub
  3. 删除以 PortableGit 开头、以随机字母和数字字符串结尾的文件夹
  4. 重新启动 GitHub。它将重新提取 dll,问题应该得到解决!

(原“答案”)
我尝试了很多东西,但我不知道最终什么是有效的。我重新启动了 GitHub,重新启动了我的计算机,卸载并重新安装了 GitHub,卸载了我最近安装但最终不需要的其他几个程序,删除了 AppData\Local 目录中的 GitHub 文件夹,下载并安装了 cygwin,可能还有一些我其他的东西我忘了。

最后一次尝试是在文件资源管理器中找到所有 cygwin1.dll 文件并将它们重命名为 cygwin1x.dll,然后重新启动我的计算机。我这样做之后,它又起作用了。

我在这里冒险猜测,但我想说的是下载并安装 cygwin 然后重新启动我的计算机就成功了。

EDIT: I found the solution.

TL;DR: Go to the GitHub AppData folder and delete the PortableGit folder, and restart GitHub

  1. Close GitHub
  2. Navigate to the GitHub AppData folder:
    C:\Users\[username]\AppData\Local\GitHub
  3. Delete the folder that starts with PortableGit and ends in a random string of letters and numbers
  4. Restart GitHub. It will re-extract the dlls and the problem should be fixed!

(Original "answer")
I tried a whole bunch of things, and I have no idea what actually worked in the end. I restarted GitHub, restarted my computer, uninstalled and reinstalled GitHub, uninstalled several other programs that I had recently installed but ended up not needing, deleted the GitHub folder in the AppData\Local directory, downloaded and installed cygwin, and possibly some other stuff I'm forgetting.

The last attempt was finding all the cygwin1.dll files in File Explorer and renaming them to cygwin1x.dll and then restarting my computer. After I did that, it worked again.

I'm hazarding a guess here, but I'm going to say that downloading and installing cygwin and then restarting my computer did the trick.

为你拒绝所有暧昧 2024-12-22 07:38:23

对我来说,原因是 git 不是通过 cygwin 安装的,尽管是从 git-scm 常规下载的。一旦我运行了 cygwin 设置,添加了 git,它就完美运行了。

For me, the cause was, git was not installed through cygwin, though the regular download from git-scm. Once I ran the cygwin setup, added git, it worked perfectly.

债姬 2024-12-22 07:38:23

您在问题陈述中没有提到这一点,但我假设您正在 64 位版本的 Windows 上运行。 Cygwin 在 64 位 Windows 上运行时存在问题,尤其是大型程序。我相信这是由于 cygwin1.dll 支持库中的内存管理问题造成的。看起来它做出了无法支持的假设,即它将永远且始终映射到每个进程中的相同地址,因此它可以将进程特定的内容(例如堆地址)保留在系统范围的全局变量中。

在我丰富的空闲时间里,我一直在努力找出有问题的部分。同时,您可以尝试对 cygwin1.dll 本身进行变基。请注意,这比它需要的要复杂得多——甚至比重新建立所有其他东西的基础还要复杂。

You don't mention this in your problem statement, but I am presuming you are running on a 64 bit version of Windows. Cygwin has problems running on 64 bit Windows, especially with large programs. I believe this is due to memory management issues within the cygwin1.dll support library. It looks like it's making the unsupportable assumption that it will forever and always be mapped to the same address in every process, so it's okay for it to keep process specific things (like heap addresses) in system-wide global variables.

In my abundant free time, I've been trying to track down the problematic bits. In the meantime, you could try rebasing cygwin1.dll itself. Be warned, that's a great whackin' lot more complicated than it needs to be - even more complicated than rebasing all of everything else.

说不完的你爱 2024-12-22 07:38:23

您使用其他命令时是否遇到此错误?使用 git --version ?

尝试重新运行 Cygwin setup.exe 并重新安装 cygwin1.dll(软件包为“Base”下的“cygwin”)和 git 软件包(软件包“git”位于“Base”下) “开发”)并重新启动。

Do you get this error with any other commands? With git --version?

Try rerunning the Cygwin setup.exe and reinstalling your cygwin1.dll (the package is "cygwin", under "Base") and your git package (package "git" under "Devel") and rebooting.

乖不如嘢 2024-12-22 07:38:23

文字墙下的解决方案(对我不起作用但也许可以帮助别人的东西?)

将 Ruby + Devkit(MSYS2 工具链)从 2.6.2-1 更新到 2.6.6-2 后我
出现 cygheap 错误,无法继续工作。我试过
这里提到的一切。可能花了 6 个多小时来解决这个问题。
什么都没起作用。我已准备好重新安装 Windows。

  • 在这场磨难中,我重新启动了数十次。
  • 我完全删除了Cygwin,系统上没有cygwin1.dll
  • 我重新安装了 Git、GithubDesktop、Ruby,并对 MSYS2 做了很多修改。唯一的结果是学习MSYS可以完全
    替换 Cygwin - 使 cygwin 变得不必要。
  • 对于设置 -> 更新&安全性 -> Windows 安全 -> 应用程序和浏览器控件 -> 利用保护设置 -> 系统设置,我将以下设置设置为“默认关闭”
    • 强制 ASLR(强制重新定位未使用 /DYNAMICBASE 编译的映像)
    • 自下而上的 ASLR(虚拟内存分配的随机位置)
    • 高熵 ASLR
  • 作为以管理员身份运行 Powershell ISE 的计算机的唯一所有者和用户,如果我尝试运行 Get-ProcessMitigation,Windows 就会厚颜无耻地告诉我不允许请求的注册表访问
    设置进程缓解。所以这是一个死胡同。
  • 我尝试使用(224MB DLL)重新设置所有 msys64 dll
    cd C:\msys64 && \usr\bin\dash /usr/bin/rebaseall -p -v

    • 在我的带有 64GB VirtualMem 的 32GB RAM 机器上,它告诉我:
      变基:可用地址空间的 DLL 过多:无法分配内存
  • 我花了很多时间调整环境变量系统路径 & 用户路径并重新启动。
    • 我了解到经常重复的“用户环境变量覆盖系统环境变量”在涉及路径变量时并不正确。系统路径优先,因为用户路径附加到系统路径以构成 $PATH 变量。
      因此,下一个项目符号是对某些人的修复,特别是 bash 无法启动的情况
    • 如果您安装了 WSL2(适用于 Linux 的 Windows 子系统),则您可能使用的是 C:\Windows\System32\bash.exe 而不是 C:\Program Files\Git \usr\bin\bash.exe.
      Win Bash 不能与 MSYS、Cygwin 或 Git-SCM 很好地配合。

      • 确保系统路径环境变量中的 C:\Program Files\Git\bin; 位于 C:\Windows\system32; 之前。自从
        system32 通常首先列出,C:\Program Files\Git\bin; 应该
        成为新的第一个条目。
  • 审查了 bash 在开始检查 $Path 操作时加载的所有文件以及它们可能加载的任何内容
    • %USERPROFILE% 中有:\.bashrc\.gitconfig\.bash_profile、<代码>\.profile
    • C:\Program Files\Git\etc中有:\profile.d\profile.d\bash_profile.sh\profile.d\env.sh\bash.bashrc
      \个人资料
    • C:\Program Files\Git\usr\etc 中还有更多与上面相同的内容

解决方案

错误消息错误地引用了 cygwin1.dll作为问题。 Windows 版 Git 使用 MSYS。 MSYS 开发人员将该文件重命名为 msys-2.0.dll 并且未能更新错误消息。

  • 找到您计算机上的所有 msys-2.0.dll 并为其添加后缀 .bkp
  • 无论您在何处找到它们,请将“C:\Program Files\Git\usr\bin\msys-2.0.dll”复制到这些位置。
    VoidTools 一切msys-2.0.dlls 的屏幕截图

注释和注释识别问题的步骤:

  • 如果您有 WSL2,请确保在系统路径环境中 C:\Program Files\Git\bin; 位于 C:\Windows\system32; 之前多变的。
    • System32 应该是第一个系统路径,但 windows bash.exe 位于该文件夹中 - 并且它与 MSYS、Cygwin 或 Git-SCM 配合得不好。 Git Bash 在列表中的位置必须高于 Win Bash。
  • 如果您要从 C:\msys64\usr\bin\msys-2.0.dll 复制到所有其他位置,那么您会丢失最后显示您所在分支的漂亮附加文本“(master)显示您所在的分支
    • 如果您决定删除所有额外的 dll 并仅将 C:\msys64\usr\bin 添加到您的路径,则同样如此,它必须相对于通常的目录查找依赖项居住。
  • 为了识别 cygheap 问题,我使用 https://learn.microsoft.com/en-us/sysinternals/downloads/listdlls
    • 在单独的窗口中为每个步骤启动一个新的 cmd.exe。必须使用精确的路径来确保加载正确的内容。
      1. MSYS(cmd.exe 窗口 #1)
        • 运行set PATH="C:\msys64\usr\bin;"
        • 运行“C:\msys64\usr\bin\bash.exe”
        • 确认/c/msys64/usr/bin/ls.exe”工作(应该加载自己的msys-2.0.dll
        • 如果引用不同的 msys-2.0.dll,以下操作将会失败
          • “/c/Program Files/Git/usr/bin/ls.exe” -> cygheap 错误
          • "/c/cygwin64/bin/ls.exe"" -> cygheap 错误
      2. Cygwin(cmd.exe 窗口 #2)
        • 运行set PATH="C:\cygwin64\bin;"
        • 运行“C:\cygwin64\bin\bash.exe”
          Cygwin 破坏了路径。检查 echo $path 是否正确。
          如果没有运行,则运行 Path="/cygdrive/c/cygwin64/bin"
        • 确认“/cygdrive/c/cygwin64/usr/bin/ls.exe”工作
        • 如果引用不同的 msys-2.0.dll,以下操作将会失败
          • “/cygdrive/c/msys64/usr/bin/ls.exe” -> cygheap 错误
          • “/cygdrive/c/Program Files/Git/usr/bin/ls.exe” -> cygheap 错误
      3. Git Bash(cmd.exe 窗口 #3)
        • 运行set PATH="C:\Program Files\Git\usr\bin\;"
        • 运行“C:\Program Files\Git\usr\bin\bash.exe”
        • 确认“/c/Program Files/Git/usr/bin/ls.exe”有效
        • 如果引用不同的 msys-2.0.dll,以下操作将会失败
          • “/c/msys64/usr/bin/ls.exe” -> cygheap 错误
          • “/c/cygwin64/bin/ls.exe” -> cygheap 错误
      4. Win Bash(cmd.exe 窗口 #4)
        • “C:\Windows\System32\bash.exe”重复此过程
        • 在我的机器上,它甚至无法启动。这是我必须在系统路径中的 system32 之前加载 Git Bash 的原因之一
    • 打开这些控制台,检查引用的 dll
    • 选择您想要在任何地方使用的一个(我认为 Git-Bash 版本最好)并删除其他的。

Solution below the wall of text (things that didn't work for me but maybe can help someone else?)

After updated Ruby + Devkit(MSYS2 toolchain) to 2.6.6-2 from 2.6.2-1 I
got the cygheap error and couldn't continue working. I tried
everything mentioned here. Probably put 6+ hrs into the problem.
Nothing worked. I was ready to reinstall Windows.

  • I've rebooted tens of times during the ordeal.
  • I deleted Cygwin entirely, there is no cygwin1.dll on the system.
  • I reinstalled Git, GithubDesktop, Ruby, and did a lot of messing around with MSYS2. The only outcome was learning MSYS can completely
    replace Cygwin - making cygwin unnecessary.
  • For Settings -> Update & Security -> Windows Security -> App & browser control -> Exploit protection settings -> System settings, I have the following set to "Off by default"
    • Mandatory ASLR (Force relocation of images not compiled with /DYNAMICBASE)
    • Bottom-up ASLR (Randomize locations for virtual memory allocations)
    • High-entropy ASLR
  • As the sole owner and user of my computer with Powershell ISE running as admin, Windows has the gall to tell me Requested registry access is not allowed if I try to run Get-ProcessMitigation or
    Set-ProcessMitigation. So that was a dead end.
  • I tried to rebaseall the msys64 dlls with (224MB of DLLs)
    cd C:\msys64 && \usr\bin\dash /usr/bin/rebaseall -p -v

    • On my 32GB RAM machine with 64GB of VirtualMem, it told me:
      rebase: Too many DLLs for available address space: Cannot allocate memory
  • I spent a lot of time tweaking EnvironmentVars System Path & User Path and restarting.
    • I learned the often repeated "User EnvVars override System EnvVars" is not true when it comes to the Path variable. System Path takes precedence because User Path is appended to System Path to make the $PATH var.
      For this reason, the next bullet is a fix for some people, especially if bash fails to start
    • If you have WSL2 (Windows Subsystem for Linux) installed, odds are you're using C:\Windows\System32\bash.exe instead of C:\Program Files\Git\usr\bin\bash.exe.
      Win Bash doesn't play nice with MSYS, Cygwin, or Git-SCM.

      • Make sure C:\Program Files\Git\bin; comes before C:\Windows\system32; in the System Path Environment Variable. Since
        system32 is typically listed first, C:\Program Files\Git\bin; should
        be the new first entry.
  • Reviewed all the files bash loads on start checking for $Path manipulation and anything they may load
    • In %USERPROFILE% there's: \.bashrc, \.gitconfig, \.bash_profile, \.profile
    • In C:\Program Files\Git\etc there's: \profile.d, \profile.d\bash_profile.sh, \profile.d\env.sh, \bash.bashrc, and
      \profile
    • In C:\Program Files\Git\usr\etc there's more of the same above

Solution

The error message incorrectly cites cygwin1.dll as the issue. Git for Windows uses MSYS. The MSYS devs renamed the file to msys-2.0.dll and failed to update the error message.

  • Find all the msys-2.0.dll's on your machine and add the suffix .bkp to them.
  • Wherever you found them at, copy "C:\Program Files\Git\usr\bin\msys-2.0.dll" to those locations.
    VoidTools Everything screenshot of msys-2.0.dlls

Notes & Steps to Identify Issue:

  • If you have WSL2, make sure C:\Program Files\Git\bin; comes before C:\Windows\system32; in the System Path Environment Variable.
    • System32 is supposed to be the first System Path, but windows bash.exe is in that folder - and it doesn't play nice with MSYS, Cygwin, or Git-SCM. Git Bash must be higher on the list to be selected over Win Bash.
  • If you were to copy from C:\msys64\usr\bin\msys-2.0.dll to all other locations, then you lose that nice additional text at the end that shows the branch you're on "(master)" Shows what branch you're on
    • Same goes if you decide to delete all the extra dlls and just add C:\msys64\usr\bin to your path, there must be a dependencies it looks for relative to the directory it normally resides.
  • To identify the cygheap problem, I checked the dlls being referenced at runtime with https://learn.microsoft.com/en-us/sysinternals/downloads/listdlls
    • Launch a new cmd.exe in a separate window for each of these steps. Must use exact paths to ensure the right things are loading.
      1. MSYS (cmd.exe window #1)
        • run set PATH="C:\msys64\usr\bin;"
        • run "C:\msys64\usr\bin\bash.exe"
        • confirm /c/msys64/usr/bin/ls.exe" works (should bcus loading own msys-2.0.dll)
        • The following will fail if they're referencing different msys-2.0.dll's
          • "/c/Program Files/Git/usr/bin/ls.exe" -> cygheap err
          • "/c/cygwin64/bin/ls.exe"" -> cygheap err
      2. Cygwin (cmd.exe window #2)
        • run set PATH="C:\cygwin64\bin;"
        • run "C:\cygwin64\bin\bash.exe"
          Cygwin mangles the path. Check echo $path is correct.
          if not run, run Path="/cygdrive/c/cygwin64/bin"
        • confirm "/cygdrive/c/cygwin64/usr/bin/ls.exe" works
        • The following will fail if they're referencing different msys-2.0.dll's
          • "/cygdrive/c/msys64/usr/bin/ls.exe" -> cygheap err
          • "/cygdrive/c/Program Files/Git/usr/bin/ls.exe" -> cygheap err
      3. Git Bash (cmd.exe window #3)
        • run set PATH="C:\Program Files\Git\usr\bin\;"
        • run "C:\Program Files\Git\usr\bin\bash.exe"
        • confirm "/c/Program Files/Git/usr/bin/ls.exe" works
        • The following will fail if they're referencing different msys-2.0.dll's
          • "/c/msys64/usr/bin/ls.exe" -> cygheap err
          • "/c/cygwin64/bin/ls.exe" -> cygheap err
      4. Win Bash (cmd.exe window #4)
        • Repeat the process for "C:\Windows\System32\bash.exe".
        • On my machine it silently fails to even start. Which is one of the reasons I must have Git Bash loaded before system32 in the System Path
    • With those consoles open, check the dlls being referenced
    • Select the one you want to use everywhere (Git-Bash version best IMO) and remove the others.
小耗子 2024-12-22 07:38:23

就我而言,环境变量中的 PATH 是错误的。我将 cygwin 移到了路径的前面一点(确保它设置在 git 路径之前)。这样 cygwin dll 有利于 git dll。

例如; C:\Program Files\Git\usr\bin;C:\cygwin\bin;... 的路径
更改为 C:\cygwin\bin;C:\Program Filenter code herees\Git\usr\bin;...

环境为 Win7x86,需要重新启动才能使用更新的路径。

In my case the PATH in the Environment Variables was wrong. I moved the cygwin a bit earlier in the path (making sure it is set before git path). That way cygwin dll was in favor of git dll.

For example; The path of C:\Program Files\Git\usr\bin;C:\cygwin\bin;...
Was changed to C:\cygwin\bin;C:\Program Filenter code herees\Git\usr\bin;...

Environment was Win7x86 and a reboot was required to that updated path is used.

叶落知秋 2024-12-22 07:38:23

对我来说,这似乎只是我的路径中有两个 msys-2.0.dll 。一份来自 Git For Windows,一份来自 Msys2。

所以解决方案就是重命名:%APPDATA%\..\Local\Programs\Git\usr\bin\msys-2.0.dll (或 %PROGRAMFILES%\Git\usr\ bin\msys-2.0.dll)到 msys-2.0.bak(或删除它)。

For me this seemed to be just that there were two msys-2.0.dll in my path. One from Git For Windows, one from Msys2.

So the solution was just to rename:%APPDATA%\..\Local\Programs\Git\usr\bin\msys-2.0.dll (or %PROGRAMFILES%\Git\usr\bin\msys-2.0.dll) to msys-2.0.bak (or delete it).

厌倦 2024-12-22 07:38:23

我知道这是一个旧线程,但由于这是此问题的第一个结果,我想添加我的解决方案,希望它对其他人有帮助。

首先,运行 cygcheck PROGRAMM ,在我的例子中,我遇到了 tar.exe 的问题,所以我运行了: cygcheck tar cygcheck 命令显示使用了哪些 DLL。

在 cygcheck 中一切看起来都是正确的,因此我根据 Jim Schneider 的评论决定从 64 位版本的 Cygwin 切换到 32 位版本,这最终解决了我的问题。

I know this is an old thread, but as it is the first result on this issue, I would like to add my resolution in the hope it helps someone else.

First, run cygcheck PROGRAMM, in my case, I had an issue with tar.exe so I ran: cygcheck tar the cygcheck command shows what DLL's are used.

Everything looked correct in cygcheck, so I decided, based on the comments of Jim Schneider, to switch from the 64bit version of Cygwin to the 32bit version, that ultimately solved my problem.

葬﹪忆之殇 2024-12-22 07:38:23

对我来说,问题是存在较旧的 C:\cygwin64 文件夹。重命名此文件夹还不够。当我删除这个文件夹后,问题就消失了。删除 C:\cygwin64 文件夹后我也不需要重新启动。

For me the problem was existence of an older C:\cygwin64 folder. Renaming this folder was not enough. When I deleted this folder then the problem went away. I did not need to reboot after deleting the C:\cygwin64 folder either.

追我者格杀勿论 2024-12-22 07:38:23

就我而言,重新启动计算机不起作用。

我最终发现这是由于Msys的安装(当我安装命令行git实用程序时安装的)之间的冲突造成的。如果您的系统路径包含任何具有 Msys 版本的目录,请删除此类路径条目并重试。看起来 cygwin 尝试执行 Msys 安装中的可执行文件,并且 .dll 检测到不匹配。

In my case rebooting the computer did not work.

I finally found that it was due to a conflict between an installation of Msys (Installed when I installed the command line git utilities). If your system path contains any directories with a version of Msys, delete such path entries and try again. It looks like cygwin tries to execute the executables from the Msys installation, and the .dll detects a missmatch.

梦初启 2024-12-22 07:38:23

当尝试使用以 #!/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 的版本不匹配,复制这些文件解决了问题

I had the same kind of error when trying to push to a git repo from visual studio 2017 using a script starting with #!/bin/sh from

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

Error message :

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.      

I tried different solutions above without success

What I did to solve the issue is copying content from :

C:\Program Files\Git\usr\bin

to

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

The issue on my computer came from a version mismatch on sh.exe, and copying these files resolved the problem

屌丝范 2024-12-22 07:38:23

我通过暂时禁用 Windows Defender 并重试解决了此问题 - 请参阅 https://superuser.com/a/1047031/158243 了解详情。

I resolved this issue by temporarily disabling Windows Defender and trying again—see https://superuser.com/a/1047031/158243 for details.

霞映澄塘 2024-12-22 07:38:23

我所有旧版本

的 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资源管理器递归查找文件更快,稍后谢谢我):
dir \msys-2.0.dll /s

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

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

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

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

我希望这对你有帮助,就像它对我有帮助一样。

Context

All my older versions of Visual Studio (2017 and 2019) were working fine, but the newly installed Visual Studio 2022 had problems with Git in my Windows 10 computer.

Solutions that did NOT Work

  • Rebooting Windows.
  • Reinstalling Git through its official installer.
  • Reinstalling/updating Cygwin64.
  • Disabling force randomization for images (mandatory ASLR) in my system's Windows Defender Security Center.
  • Excluding ASLR for git executables.
  • Finding and deleting newer versions of cygwin1.dll.

Actual Solution

  1. Find all msys-2.0.dll (the method below is faster for finding files recursively than Windows Explorer, thank me later):
dir \msys-2.0.dll /s

NOTE: As others pointed out, Git for Windows is actually using MSYS and not Cygwin. The MSYS team forgot to change the error messages when they imported and modified the Cygwin source code (source). Therefore, the actual file to search and delete is msys-2.0.dll, and NOT cygwin1.dll.

  1. Delete the occurrences of this file pertaining to the Visual Studio version which you are having trouble with. For instance, if you are having trouble with only Visual Studio 2022, then you only delete the msys-2.0.dll from the paths beginning with C:\Program Files\Microsoft Visual Studio\2022\ and C:\Program Files (x86)\Microsoft Visual Studio\2022\.
  2. Delete the folder C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git.
  3. Open the Visual Studio Installer, -- you likely already have it on your computer since you have Visual Studio, otherwise, download it -- click on Modify the Visual Studio version which you are having trouble with, click on Individual components, and check the Git for Windows option under Code tools.

NOTE: It doesn't matter if you already have Git installed in your machine; you still need to do this step.

  1. Restart your computer.
  2. Done.

I hope this helps you as it helped me.

倾城花音 2024-12-22 07:38:23

对我来说,混乱的是 cygwin1.dll 的多个版本。我只是通过删除此路径 C:\Users\someone\AppData\Roaming\Microsoft\Windows\Recent 中的 cygwin1.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 文件,上面的路径引起了我的注意。我将其删除并再次测试。宾果游戏。

For me, it was the multiple versions of cygwin1.dll that messed up. I just made it by removing the link file of cygwin1.dll in this path C:\Users\someone\AppData\Roaming\Microsoft\Windows\Recent. The following were the error tips.

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.

I used everything to find all cygwin1.dll files and the path above attracted my attention. I removed it and tested it again. Bingo.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文