Github/Cygwin error: cygheap base mismatch detected

The shell from git-for-windows (based on msys2) is not meant to be run in Cygwin or a different install of msys2.

GitHub Desktop uses an old git-for-windows (2.5.3, Sept. 2015)

For a git bash session, you do not need Cygwin or GitHub Desktop.

Uncompress the latest git-for-windows azrchive you can find:

  • PortableGit-2.7.0-64-bit.7z.exe => c:\prgs\git\PortableGit-2.7.0-64-bit

Then:

cd c:\prgs\git
mklink /J latest PortableGit-2.7.0-64-bit
set GIT_ROOT=c:\prgs\git\latest
set PATH=%PATH%;%GIT_ROOT%;%GIT_ROOT%\bin;%GIT_ROOT%\cmd;%GIT_ROOT%\us`\bin

You will then be able to type git-bash to launch a linux-based bash session.

Or, from a regular CMD shell session, you will have access to 200+ unix commands (curl, cat, xargs, ls, ...).
No need for Cygwin.


A more complete process was suggested by Laurisaar, referring to "Git Bash running error, version 2.16.2-64-bit".

In a git bash session:

cd usr/bin
cp msys-2.0.dll ../
rebase -b 0x76000000 ../msys-2.0.dll
rebase -b 0x30000000 ../msys-2.0.dll
cp ../msys-2.0.dll .

Re-run git-bash.exe, the problem is solved!

If the problem persists, you can try to modify the registry:

  1. Open the run, enter regedit to open the registry

  2. Find the value of [HKEY_CLASSES_ROOT\Directory\Background\shell\git_shell\command] in the directory C:\Program Files\Git\git-bash.exe

  3. Replace it with C:\Program Files\Git\bin\sh.exe


Rebooting fixed it for me. I probably got this error because of upgrading Git for Windows. Try rebooting before doing any of the other crazy things!


Disable Force randomization for images (mandatory ASLR) in your system's Windows Defender Security Center. Or exclude ASLR for git executables:

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

Tags:

Git

Cygwin

Github