Cygwin/Git error cygheap base mismatch detected

2020-02-17 06:41发布

问题:

I have installed two windows servers with the latest versions of cygwin and git, and 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/htdocs/myfolder...
    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 fro cygwin1.dll using the WIndows Start->Find/Search facility and delete all bu 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 distrubtion. 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 oobjects: 100% (3106/3106), done.
fatal: write error: Broken pipe

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

回答1:

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.



回答2:

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.



回答3:

No Cygwin, no GitHub

I've only started experiencing this lately, and none of the answers above applied to my case - I didn't have Cygwin or GitHub installed.

Instead, in my case a Windows security feature, Address Space Layout Randomization or ASLR created this problem. This is off by default for programs that do not mark themselves compatible.
However, I've enabled ASLR for all programs for additional safety. The downside is that git commands don't work now.

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 }


回答4:

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.



回答5:

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.



回答6:

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.



回答7:

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.



回答8:

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.



回答9:

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.



回答10:

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.



回答11:

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



回答12:

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



回答13:

Since it is a base mismatch you could try to rebase:

git rebase <branch>


标签: git ssh cygwin