Building Git 2.0.0 from sources on Windows


Interested in binaries? Git 2.0.0 build can be fetched from my Github repo https://github.com/madhur/msysgit-2.0.0 Note that I have not tested it thoroughly myself. If you face any issues, do bring it to my notice but I am in no way responsible for it. Use it at your own risk.

Git 2.0.0 just released few days back.

As of this writing, MsysGit for Windows has latest version 1.9.2 available for download.

Eager to try out this new version, I decided to build it myself.

Place it in a directory such as C:\gitbuild

Copy this entire source into the git directory in C:\gitbuild\git

Note: Actually, the git repository in the first step has a submodule pointing to the second repository in C:\gitbuild\git. If you are familiar with Git > submodules, you can download via submodule command as well.

  • Execute msys.bat from C:\gitbuild\. You should be now in bash console as follows:
Welcome to msysGit


Run 'git help git' to display the help index.
Run 'git help <command>' to display help for specific commands.
Run '/share/msysGit/add-shortcut.tcl' to add a shortcut to msysGit.

It appears that you installed msysGit using the full installer.
To set up the Git repositories, please run /share/msysGit/initialize.sh

[email protected] /
$

Note: In some envrionments, the build process should automatically begin after executing msys.bat. If it doesn't go to the next step.

  • cd to C:\gitbuild\git and execute make command. The build process should now begin:
C:\gitbuild>msys.bat

-------------------------------------------------------
Building and Installing Git
-------------------------------------------------------
GIT_VERSION = 2.0.0
    * new build flags
    CC credential-store.o
    * new link flags
    CC abspath.o
    CC advice.o
    CC alias.o
    CC alloc.o
    CC archive.o
    CC archive-tar.o

Once the build is complete, you may exit the bash shell.

  • The build process automatically places the git binaries in C:\gitbuild\bin. To confirm you have successfully built, cd to C:\gitbuild\bin and execute git.exe
C:\gitbuild\bin>git --version
git version 2.0.0
  • Congratulations you have just built Git 2.0.0 from sources. However, there are some quirks and tweaks required to be corrected, which we cover in next steps.

  • git gui command throws an error as follows:

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?

The reason of error is because git gui depends on Tcl/Tl 8.5.13 package. I just copied the following files and folders from my old build and it works fine.

git\lib\tcl8
git\lib\tcl8.5
git\lib\tk8.5
git\lib\tclConfig.sh
git\lib\tkConfig.sh
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

After copying these files, git gui should work fine.

  • At this point, you have working version of Git 2.0.0 and you can remove the sources if you want.

If you get the error fatal: unable to access '.....git/': SSL certificate problem: unable to get local issuer certificate , you may have to put this line in your .gitconfig. Replace d with your drive letter.

[http]
    sslCAinfo = d:/gitbuild/mingw/bin/curl-ca-bundle.crt
  • You can also place your ssh private and public key in the .ssh folder in C:\gitbuild in order to work with Github
ssh -T [email protected]
Warning: Permanently added the RSA host key for IP address 'x.x.x.x' to the list of known hosts.
Enter passphrase for key '/.ssh/id_rsa':
Hi madhur! You've successfully authenticated, but GitHub does not provide shell access.