How to install Git on Windows

If you want to install Git on Windows you have two options; using msysgit or Cygwin. Using msysgit is the easiest way and probably the most popular one, but it does not allow you to use the latest version of Git as soon as it’s released. This is one of many reasons I prefer Cygwin over msysgit but it shouldn’t be any limitation if you prefer one option over the other. Since I’m a Cygwin user, it was a natural choice for me, so fell free to chose the one that suits you best.

That said, I’ll show you how to install Git v1.7.0 using Cygwin v1.7.1-1 on Windows 7.

Installing Cygwin

Download Cygwin here and run the setup. Accept the defaults (or customize it if you prefer to install in different place) until you get to the “Select Packages” step.

To select a package, change the “View” to full, type the name in the search box and press the word “Skip” once. This will select the last available version and all the required package dependencies as shown in the picture:

Select Packages

Select the following packages:

  • zlib
  • openssh
  • openssl
  • perl
  • subversion-perl (if you want to use git-svn)
  • curl
  • libcurl-devel
  • expat
  • tcltk
  • make
  • gcc
  • ncurses (if you want to use the clear command)
  • python

Click “Next” to download and install. After installation, check the option to add an icon to the Start menu.

Installing Git

Open Cygwin bash shell (Start –> All Programs -> Cygwin -> Cygwin Bash Shell) and type the following commands to download and install Git source package:

cd /usr/src
curl -O http://kernel.org/pub/software/scm/git/git-1.7.0.tar.gz
tar xzvf git-1.7.0.tar.gz
cd git-1.7.0
./configure --prefix=/usr/local
make
make install
cd ..
which git

You should see /usr/local/bin/git.

Next, download and install the Git man pages:

curl -O http://www.kernel.org/pub/software/scm/git/git-manpages-1.7.0.tar.gz
mkdir /usr/local/man
tar xvf git-manpages-1.7.0.tar.gz -C /usr/local/man

That’s all. In the next article I’ll write about how to configure Git to integrate with tools like Notepad++ and Beyond Compare.

Shout it