How can I fix Git bash not working on Windows

0

I uninstalled a few apps in control panel, then my git bash stopped working.

I think its related but not sure what it might be that made it stop. When I run bash outside of vscode i get the following (screenshot)

enter image description here

The only apps I remember uninstalling were Windows SDK tools and Visual Studio Installer.

I tried re-installing git bash but I still get the same error.

I get the following error in vs-code terminal

      2 [main] bash (12412) C:\Program Files\Git\bin\..\usr\bin\bash.exe: *** fa
tal error - cygheap base mismatch detected - 0x1368408/0x12C8408.
This problem is probably due to using incompatible versions of the cygwin DLL.
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.
      2 [main] bash 100 dofork: child -1 - forked process 12412 died unexpectedly, retry 0, exit code 0xC0000142, errno 11
bash: fork: retry: Resource temporarily unavailable
      2 [main] bash (8824) C:\Program Files\Git\bin\..\usr\bin\bash.exe: *** fatal error - cygheap base mismatch detected - 0x1368408/0x1308408.
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.
1290157 [main] bash 100 dofork: child -1 - forked process 8824 died unexpectedly, retry 0, exit code 0xC0000142, errno 11
bash: fork: retry: Resource temporarily unavailable
      2 [main] bash (14364) C:\Program Files\Git\bin\..\usr\bin\bash.exe: *** fatal error - cygheap base mismatch detected - 0x1368408/0x1388408.
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.
3499346 [main] bash 100 dofork: child -1 - forked process 14364 died unexpectedly, retry 0, exit code 0xC0000142, errno 11
bash: fork: retry: Resource temporarily unavailable
      2 [main] bash (7688) C:\Program Files\Git\bin\..\usr\bin\bash.exe: *** fatal error - cygheap base mismatch detected - 0x1368408/0x1388408.
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.
4652774 [main] bash 100 dofork: child -1 - forked process 7688 died unexpectedly, retry 0, exit code 0xC0000142, errno 11
bash: fork: retry: Resource temporarily unavailable
      2 [main] bash (2216) C:\Program Files\Git\bin\..\usr\bin\bash.exe: *** fatal error - cygheap base mismatch detected - 0x1368408/0x11D8408.
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.
6724468 [main] bash 100 dofork: child -1 - forked process 2216 died unexpectedly, retry 0, exit code 0xC0000142, errno 11
bash: fork: retry: Resource temporarily unavailable
      2 [main] bash (3380) C:\Program Files\Git\bin\..\usr\bin\bash.exe: *** fatal error - cygheap base mismatch detected - 0x1368408/0x11D8408.
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.
10811431 [main] bash 100 dofork: child -1 - forked process 3380 died unexpectedly, retry 0, exit code 0xC0000142, errno 11
bash: fork: retry: Resource temporarily unavailable
      2 [main] bash (14080) C:\Program Files\Git\bin\..\usr\bin\bash.exe: *** fatal error - cygheap base mismatch detected - 0x1368408/0x1308408.
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.
18892759 [main] bash 100 dofork: child -1 - forked process 14080 died unexpectedly, retry 0, exit code 0xC0000142, errno 11
bash: fork: Resource temporarily unavailable
bash-4.4$
windows
bash
git
visual-studio-code
asked on Stack Overflow Aug 7, 2020 by S.McDonald

1 Answer

2

copy from https://github.com/mintty/wsltty/issues/6

Here is the fix.

  1. Go to you Windows Defender Security Center settings
  2. Click on App & Browser Control
  3. At the bottom click on the "Exploit Protection Settings" link
  4. Go to "Program Settings" and click on the "Add program to customize" -> "Choose exact file path"
  5. Navigate to "C:\Program Files\Git\usr\bin\sh.exe" and add it
  6. Override and turn off the following: Mandatory ASLR Randomize memory allocations (Bottom-up ASLR)
  7. Click "Apply" and now everything should work fine.

Also add these other binaries from the same folder: expr.exe, uname.exe, grep.exe, rm.exe

Good luck, Gabriel

answered on Stack Overflow Aug 7, 2020 by spike 王建

User contributions licensed under CC BY-SA 3.0