How do I build and use the latest version of git on cygwin?

To compile git, you're going to need to install a few required packages. I'm going to assume you know how to install things on cygwin by using their setup.exe. Here's what you need to install:

git (you need git to get git source)
make
gcc-core
libcurl-devel
openssl-devel
subversion-perl
dos2unix
libiconv
libiconv-devel
gettext
expat
gettext-devel
expat-devel

Here's how you get the source:

git clone https://kernel.googlesource.com/pub/scm/git/git.git
cd git

Now for some reason I don't understand, I have to convert all the files to have unix line endings. I don't understand why they didn't already come that way. I did that with this:

find . -type f | xargs dos2unix

Finally I did these steps:

  make -j8
  make test; # optional, to verify that the git you built works ok
  export PATH=$(pwd)/bin-wrappers:$PATH

The git binaries are in ./bin-wrappers. You probably want to permanently add that directory to your path.

Tags:

Git

Cygwin