Upgrade Git to Latest Stable Release in Cygwin

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.

  1. 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.
  2. 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
  3. 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.git

    An alternative solution to fix the ca-certificates package until an update is available is described in this post.

  4. The local git repository will contain multiple versions of git. To select a version, follow these steps:
    1. List the available git versions, run the following commands:

      cd git
      git tag
    2. Checkout the desired version by running the following command, substituting the desired version tag name:

      git checkout v1.8.4.3
  5. Make the git configuration script by running the following command:

    make configure
  6. Run the git configuration script to set the installation location:

    ./configure --prefix=/usr
  7. Make git programs and documentation by running the following command:

    make all doc
  8. Install git programs and documentation by running the following command:

    make install install-doc install-html
  9. Verify the git version by running the following command:

    git version
Posted in Windows Tagged with: ,
6 comments on “Upgrade Git to Latest Stable Release in Cygwin
  1. 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

  2. Simon Buchan says:

    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 🙂

  3. kghastie says:

    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

  4. Xin says:

    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”

Leave a Reply

Your email address will not be published. Required fields are marked *

*