Build GIT on Windows from Sources

Build GIT on Windows from Sources

Let's Rock

Unluckily for windows users GIT does not get updated as often as it should, and the last precompiled installer is version 1.9.5 from december 2014. But GIT 2.3 is already out. 

The GIT for Windows Team has made a 2.x release - with many improvements. See it here. If you still want to build your own GIT, keep on reading.

To follow this tutorial you must be running a Windows OS, and install the old precompiled version of GIT from the official webpage using the installer.

Checkout msysgit to a local directory such as d:\guitbuild

git clone "d:\guitbuild"

Checkout git to d:\guitbuild\git

git clone "d:\guitbuild\git"

Execute msys.bat inside gitbuild (takes a while...):


You will now be in the GIT console, cd to d:\gitbuild\git and run the make command:

cd d:/gitbuild/git

(notice the forwardslahes in the path!)

During the make process the GIT binaries have been copied to:


Now exit the bash and open a regular command prompt to see current GIT version

d:/gitbuild/git --version
git version

If you are seeing an error such as this one, make sure that you PATH system variable does not contain a path that points to a location containing an old version of the libiconv-2.dll/libiconv2.dll

In our case the issue was because Drush was installed and the following path containing an old version of the DLL was present:

C:\Program Files (x86)\Drush\GnuWin32\bin

You also need make sure there is a libiconv-2.dll library inside your bin folder. If it is not, just copy the libiconv2.dll and rename it.

Now try running the following command

d:\gitbuild\bin\git gui

You will get this error:

git-gui: line 3: exec: wish: not found
fatal: 'gui' appears to be a git command, but we were not
able to execute it. Maybe git-gui is broken?

This is because git gui depends on Tcl/Tl  8.5.13 package. Download the binaries and drop them into the bin and lib folder. If you have an older version of GIT installed (look in c:\program files (x86)\git\bin) you can copy the following files/folders:

  • git\lib\tcl8
  • git\lib\tcl8.5
  • git\lib\tk8.5
  • git\lib\
  • git\lib\


  • git\bin\wish.exe
  • git\bin\wish85.exe
  • git\bin\tcl85.dll
  • git\bin\tclpip85.dll
  • git\bin\tclsh.exe
  • git\bin\tclsh85.exe
  • git\bin\tk85.exe

To replace the system-wide installation of GIT, copy replace the bin and lib folder in c:\program files (x86)\git with the ones in d:\gitbuild\.

Remember also to copy the new version of GIT.exe into the c:\program files (x86)\git\cmd location.

Now you have a functional and up-to-date GIT compilation!

As a present for this particular post, here go the 2.3.1 binaries. Just unzip inside c:\program files (x86)\git and will work out of the box to replace your current installation!

Read this article if you are experiencing the git shell on Windows reports “sh.exe has stopped working (APPCRASH)” when using GIT for Windows on Virtual Machines that have Xen Tools installed (such as Rackspace!)


Thanks for this! I couldn't find this information on their repository or README so I really appreciate the trial and error you went through to figure it out.

Add new comment

By: david_garcia Tuesday, March 10, 2015 - 21:53