Cygwin/Git error cygheap base mismatch detected

Solution 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.

Solution 2:

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 }

Solution 3:

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.

Solution 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.