'CloneCommand.ExecuteClone error ("Fatal error in forked process - fork: can't reserve memory for parent stack", Visual Studio 2022, Git clone command)

In VS 2022 (17.0 or 17.1), when performing a Git clone of any repo (I've only tested those in our Azure DevOps instance, but I don't suspect the repos are the issue), I get a VS error dialog with only the message CloneCommand.ExecuteClone.

enter image description here

The Output window has this error pattern repeated 13 times, with the line referencing git-sh-i18n only found after the last error block, like so (the git-sh-i18n file is present, I assume the error is related to a language file it's unable to find):

Updating files: 100% (4649/4649), done.
      0 [main] sh 1930 c:\program files\microsoft visual studio\2022\enterprise\common7\ide\commonextensions\microsoft\teamfoundation\team explorer\Git\usr\bin\sh.exe: *** fatal error in forked process - fork: can't reserve memory for parent stack 0x4E00000 - 0x5000000, (child has 0x4A00000 - 0x4C00000), Win32 error 487
   1301 [main] sh 1930 cygwin_exception::open_stackdumpfile: Dumping stack trace to sh.exe.stackdump
      1 [main] sh 1929 dofork: child -1 - forked process 17816 died unexpectedly, retry 0, exit code 0x100, errno 11
c:/program files/microsoft visual studio/2022/enterprise/common7/ide/commonextensions/microsoft/teamfoundation/team explorer/Git/mingw32/libexec/git-core\git-submodule: fork: retry: Resource temporarily unavailable
/mingw32/libexec/git-core/git-sh-setup: line 46: /git-sh-i18n: No such file or directory

The sh.exe.stackdump file has no other file references or useful info, just 3 lines of memory locations.

It seems like it might be a Cygwin memory allocation issue - I've read it has issues with fixed memory locations. Similar issues reference a need to exclude ASLR for git executables, PATH environment variable issues, having WSL2 installed, or 32- vs 64-bit client issues, but I haven't found a good solution yet and I'm not certain when it started.

I do have WSL2 installed, and the latest 64-bit Git for Windows (2.35.1.2).



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source