Github/Cygwin error: cygheap base mismatch detected

后端 未结 7 901
小蘑菇
小蘑菇 2020-12-28 15:50

Git has been giving me this error

    0 [main] sh (47116) C:\\Users\\Marcus\\AppData\\Local\\GitHub\\PortableGit_c7e0cbde92ba565cb218a521411d0e854079a28c\\us         


        
相关标签:
7条回答
  • 2020-12-28 16:11

    some packages in MSYS2 you installed is in conflict with x:\cygwin\bin,so just delete MSYS2 PATH in system environment

    0 讨论(0)
  • 2020-12-28 16:13

    After enabling Mandatory ALSR by default on Windows 10.

    I need to disable ForceRelocateImages to all git-bash executables. Todo this, create a small PowerShell script or type direct in PowerShell the code below. You need to run PowerShell as an administrator.

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

    After that, git-bash works fine.

    0 讨论(0)
  • 2020-12-28 16:16

    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.

    0 讨论(0)
  • 2020-12-28 16:23

    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!

    0 讨论(0)
  • 2020-12-28 16:25

    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 }
    
    0 讨论(0)
  • 2020-12-28 16:26

    I had a very similar problem, but neither restarts nor reinstalling git or cygwin helped. I always got:

          1 [main] sh (12220) C:\Program Files\Git\usr\bin\sh.exe: *** fatal error - cygheap base mismatch detected - 0x37C7408/0x38E7408.
    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.
          0 [main] sh 6928 fork: child -1 - forked process 12220 died unexpectedly, retry 0, exit code 0xC0000142, errno 11
    C:\Program Files\Git\mingw64/libexec/git-core\git-stash: fork: retry: Resource temporarily unavailable
    

    Took me a while to figure out that it started after I read about a windows bug related to "System-wide mandatory ASLR", and how the settings available via Windows UI weren't setting the proper registry keys. After making my system more secure by adding this registry entry, cygwin forking broke:

    Windows Registry Editor Version 5.00 
    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\kernel]
    "MitigationOptions"=hex:00,01,01,00,00,00,00,00,00,00,00,00,00,00,00,00
    

    Source: Clarifying the behavior of mandatory ASLR

    That resulted in git-stash not working anymore, nor cygwin working (which I installed later. Removing that registry key again fixed the issue.

    0 讨论(0)
提交回复
热议问题