Git is included as an available package in Cygwin; however, it is not generally the latest stable release. Using the steps outlined below, I have been able to successfully upgrade to the latest stable release of Git within my Cygwin environment.
- Download and run the Cygwin setup-x86.exe (32-bit) or setup-x86_64.exe (64-bit) program from http://cygwin.com/install.html
If you already have Cygwin installed, that should not be a problem. You can still run the setup program to install additional Cygwin packages. - Proceed through the Cygwin setup process until you get to the "Select Packages" screen. From there, make sure the following packages are selected:
- asciidoc
- autoconf
- ca-certificates
- docbook-xml45
- gcc-core
- gettext-devel (thanks to Simon Buchan and kghastie for pointing this out)
- git (needed to retrieve most current version of git)
- libcurl-devel
- libiconv-devel
- make
- xmlto (may get post-install script error)
- zlib-devel
- Open a Cygwin terminal and run the following command to retrieve the current git repository:
git clone --config core.autocrlf=false https://github.com/git/git.git
This will download the git repository to a local "git" subdirectory.Note: There seems to be a problem with verion 1.94-1 of the ca-certificates Cygwin package where the files containing the trusted certificates are empty. This causes the following error condition:
$ git clone --config core.autocrlf=false https://github.com/git/git.git
Cloning into ‘git'...
fatal: unable to access ‘https://github.com/git/git.git/': error setting certificate verify locations:
CAfile: /usr/ssl/certs/ca-bundle.crt
CApath: none
A quick, but risky work-around is to disable SSL verification. To do this without changing any default settings, use the following command instead:
git clone --config core.autocrlf=false --config http.sslverify=false https://github.com/git/git.gitAn alternative solution to fix the ca-certificates package until an update is available is described in this post.
- The local git repository will contain multiple versions of git. To select a version, follow these steps:
-
List the available git versions, run the following commands:
cd git
git tag
-
Checkout the desired version by running the following command, substituting the desired version tag name:
git checkout v1.8.4.3
-
List the available git versions, run the following commands:
- Make the git configuration script by running the following command:
make configure - Run the git configuration script to set the installation location:
./configure --prefix=/usr - Make git programs and documentation by running the following command:
make all doc - Install git programs and documentation by running the following command:
make install install-doc install-html - Verify the git version by running the following command:
git version
Nice post, worked like a charm on a new Cygwin install, I am now on Git 2.0.0rc4 🙂 Just one thing to add: this won’t include the incredibly useful “git subtree” command. It’s in the contrib directory and there are full instructions in the folder, but in essence you just need to
cd contrib/subtree
make
make install
make install-doc
Missing required package gettext-devel. You should also warn that asciidoc is potentially gargantuan to pull, as it pulls a whole bunch of X11 stuff in with it 🙂
Thanks for pointing this out. I added gettext-devel to the list in the post.
Yep, I needed gettext-devel, too. Here’s where the make failed without it:
/usr/lib/gcc/i686-pc-cygwin/4.8.3/../../../../i686-pc-cygwin/bin/ld: cannot find -liconv
collect2: error: ld returned 1 exit status
Makefile:2055: recipe for target ‘git-credential-store.exe’ failed
make: *** [git-credential-store.exe] Error 1
Thanks for pointing this out. I added gettext-devel to the list in the post.
Nice post. For me, the openssl-devel package is required, otherwise will get “git-compat-util.h:280:25: fatal error: openssl/ssl.h: No such file or directory compilation terminated.” error when run “make all doc”