Cygwin/Git error cygheap base mismatch detected

I have installed two windows servers with the latest versions of cygwin and git, and am trying to clone the git repository from S1, to S2. I can successfully ssh from S2 to S1 using RSA keys, but when I do this:
git clone “ssh://root@S1/path/to/my/repo”
It throws back this output:

    Cloning into /cygdrive/c/program files/apache software foundation/apache2.2/htdocs/myfolder...
    2 [main] git 2004 C:/cygwin/lib/git-core/git.exe *** fatal error - cygheap base mismatch detected - 0x61242860/0x6123790.
This problem is probably due to using incompatible versions of the cygwin DLL.
Search fro cygwin1.dll using the WIndows Start->Find/Search facility and delete all bu 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 distrubtion. Rebooting is also suggested if you are unable to find another cygwin DLL.  

--5 more errors like that one --

remote: Counting objects: 3275, done.
remote: Compressing oobjects: 100% (3106/3106), done.
fatal: write error: Broken pipe

So I followed these instructions, but no luck. Any suggestions?

  • Error “Unlinking directory not permitted” when I'm doing hg update with cygwin
  • Net Start SSHD HELPMSG 3534
  • Keep being prompted to enter passphrase for .ssh/id_rsa
  • How to make git push work with Cygwin?
  • Why is git slow on my windows machine?
  • Able to push, fetch but not pull
  • Use Git with existing files and update branch after push
  • Paperclip files get deleted after each deploy
  • Recover a commit sent as a pull-request from a deleted fork on GitHub
  • Symfony2 - creating own vendor bundle - project and git strategy
  • git repositiory adding files
  • GitCloneTask doesn't clone repository (“The remote end hung up unexpectedly”)
  • 7 Solutions collect form web for “Cygwin/Git error cygheap base mismatch detected”

    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.

    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.

    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.

    Do you get this error with any other commands? With git --version?

    Try rerunning the Cygwin setup.exe and reinstalling your cygwin1.dll (the package is “cygwin”, under “Base”) and your git package (package “git” under “Devel”) and rebooting.

    For me, the cause was, git was not installed through cygwin, though the regular download from git-scm. Once I ran the cygwin setup, added git, it worked perfectly.

    For me the problem was existence of an older C:\cygwin64 folder. Renaming this folder was not enough. When I deleted this folder then the problem went away. I did not need to reboot after deleting the C:\cygwin64 folder either.

    Since it is a base mismatch you could try to rebase:

    git rebase <branch>
    
    Git Baby is a git and github fan, let's start git clone.