Cygwin/Git 错误 cygheap 检测到碱基不匹配
我已经安装了两台 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(16)
我也有同样的问题。
我刚刚重新启动我的电脑,它又恢复正常了。
它无助于找到问题的原因,但至少你可以继续工作。
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.
cygwin/git 可能会受到 ASLR 的影响
在我的例子中,一个名为地址空间布局随机化 (ASLR) 的 Windows 安全功能造成了这个问题。对于不标记自身兼容的程序,ASLR 应默认关闭(更多信息)。
我还没有检查 cygwin/git 二进制文件的标头中是否有此标志,但我确实为所有应用程序手动启用了 ASLR 作为额外的安全措施。事实证明,这使得 git 命令停止工作。
解决方案
解决方案是排除 git 可执行文件的 ASLR。因为它们有很多,我不得不使用 PowerShell 作为 < em>管理员:
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:
编辑:我找到了解决方案。
TL;DR: 转到 GitHub AppData 文件夹并删除 PortableGit 文件夹,然后重新启动 GitHub
C:\Users\[用户名]\AppData\Local\GitHub
PortableGit
开头、以随机字母和数字字符串结尾的文件夹(原“答案”)
我尝试了很多东西,但我不知道最终什么是有效的。我重新启动了 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
C:\Users\[username]\AppData\Local\GitHub
PortableGit
and ends in a random string of letters and numbers(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.对我来说,原因是 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.
您在问题陈述中没有提到这一点,但我假设您正在 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.
您使用其他命令时是否遇到此错误?使用 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 yourcygwin1.dll
(the package is "cygwin", under "Base") and your git package (package "git" under "Devel") and rebooting.文字墙下的解决方案(对我不起作用但也许可以帮助别人的东西?)
解决方案
错误消息错误地引用了
cygwin1.dll
作为问题。 Windows 版 Git 使用 MSYS。 MSYS 开发人员将该文件重命名为msys-2.0.dll
并且未能更新错误消息。msys-2.0.dll
并为其添加后缀.bkp
。注释和注释识别问题的步骤:
C:\Program Files\Git\bin;
位于C:\Windows\system32;
之前多变的。bash.exe
位于该文件夹中 - 并且它与 MSYS、Cygwin 或 Git-SCM 配合得不好。 Git Bash 在列表中的位置必须高于 Win Bash。(master)
”C:\msys64\usr\bin
添加到您的路径,则同样如此,它必须相对于通常的目录查找依赖项居住。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 错误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 错误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 错误“C:\Windows\System32\bash.exe”重复此过程
。listdlls -r bash
(在本例中
msys-2.0.dll
)listdlls -r -v -d msys-2.0。 dll
Solution below the wall of text (things that didn't work for me but maybe can help someone else?)
Solution
The error message incorrectly cites
cygwin1.dll
as the issue. Git for Windows uses MSYS. The MSYS devs renamed the file tomsys-2.0.dll
and failed to update the error message.msys-2.0.dll
's on your machine and add the suffix.bkp
to them."C:\Program Files\Git\usr\bin\msys-2.0.dll"
to those locations.Notes & Steps to Identify Issue:
C:\Program Files\Git\bin;
comes beforeC:\Windows\system32;
in the System Path Environment Variable.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.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)
"C:\msys64\usr\bin
to your path, there must be a dependencies it looks for relative to the directory it normally resides.cygheap
problem, I checked the dlls being referenced at runtime with https://learn.microsoft.com/en-us/sysinternals/downloads/listdllsset PATH="C:\msys64\usr\bin;"
"C:\msys64\usr\bin\bash.exe"
/c/msys64/usr/bin/ls.exe"
works (should bcus loading ownmsys-2.0.dll
)msys-2.0.dll
's"/c/Program Files/Git/usr/bin/ls.exe"
-> cygheap err"/c/cygwin64/bin/ls.exe""
-> cygheap errset PATH="C:\cygwin64\bin;"
"C:\cygwin64\bin\bash.exe"
Cygwin mangles the path. Check
echo $path
is correct.if not run, run
Path="/cygdrive/c/cygwin64/bin"
"/cygdrive/c/cygwin64/usr/bin/ls.exe"
worksmsys-2.0.dll
's"/cygdrive/c/msys64/usr/bin/ls.exe"
-> cygheap err"/cygdrive/c/Program Files/Git/usr/bin/ls.exe"
-> cygheap errset PATH="C:\Program Files\Git\usr\bin\;"
"C:\Program Files\Git\usr\bin\bash.exe"
"/c/Program Files/Git/usr/bin/ls.exe"
worksmsys-2.0.dll
's"/c/msys64/usr/bin/ls.exe"
-> cygheap err"/c/cygwin64/bin/ls.exe"
-> cygheap err"C:\Windows\System32\bash.exe"
.listdlls -r bash
(in this case
msys-2.0.dll
)listdlls -r -v -d msys-2.0.dll
就我而言,环境变量中的 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.
对我来说,这似乎只是我的路径中有两个
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
) tomsys-2.0.bak
(or delete it).我知道这是一个旧线程,但由于这是此问题的第一个结果,我想添加我的解决方案,希望它对其他人有帮助。
首先,运行 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 withtar.exe
so I ran:cygcheck tar
thecygcheck
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.对我来说,问题是存在较旧的 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.
就我而言,重新启动计算机不起作用。
我最终发现这是由于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.
当尝试使用以 #!/bin/sh 开头的脚本从 Visual Studio 2017 推送到 git 存储库时,我遇到了同样的错误 错误
消息:
我尝试了上面的不同解决方案,但没有成功
我为解决问题所做的就是复制内容来自:
到
我的计算机上的问题来自 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
Error message :
I tried different solutions above without success
What I did to solve the issue is copying content from :
to
The issue on my computer came from a version mismatch on sh.exe, and copying these files resolved the problem
我通过暂时禁用 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.
我所有旧版本
的 Visual Studio(2017 和 2019)都工作正常,但新安装的 Visual Studio 2022 在我的 Windows 10 计算机中出现 Git 问题。
重新启动 Windows不起作用的解决方案
实际解决方案
msys-2.0.dll
(以下方法比Windows资源管理器递归查找文件更快,稍后谢谢我):注意:正如其他人指出的那样,< code>Git for Windows 实际上使用的是
MSYS
而不是Cygwin
。 MSYS 团队在导入和修改 Cygwin 源代码(源)时忘记更改错误消息。因此,要搜索和删除的实际文件是msys-2.0.dll
,而不是cygwin1.dll
。C:\Program Files\Microsoft Visual Studio\2022 开头的路径中删除
和msys-2.0.dll
\C:\Program Files (x86)\Microsoft Visual Studio\2022\
。C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git
。Git for Windows
选项。注意:您的计算机中是否已经安装了 Git 并不重要;您仍然需要执行此步骤。
我希望这对你有帮助,就像它对我有帮助一样。
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
cygwin1.dll
.Actual Solution
msys-2.0.dll
(the method below is faster for finding files recursively than Windows Explorer, thank me later):NOTE: As others pointed out,
Git for Windows
is actually usingMSYS
and notCygwin
. 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 ismsys-2.0.dll
, and NOTcygwin1.dll
.msys-2.0.dll
from the paths beginning withC:\Program Files\Microsoft Visual Studio\2022\
andC:\Program Files (x86)\Microsoft Visual Studio\2022\
.C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git
.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.
I hope this helps you as it helped me.
对我来说,混乱的是 cygwin1.dll 的多个版本。我只是通过删除此路径
C:\Users\someone\AppData\Roaming\Microsoft\Windows\Recent
中的cygwin1.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 ofcygwin1.dll
in this pathC:\Users\someone\AppData\Roaming\Microsoft\Windows\Recent
. The following were the error tips.I used
everything
to find allcygwin1.dll
files and the path above attracted my attention. I removed it and tested it again. Bingo.