Appendix A: Installation

Installing Git is easy and fast, as it comes with pre-configured packages for most systems. For the sake of completeness, however, we’ll document the most important steps under Linux, Mac OS X, and Windows.

A.1. Linux

Due to the large number of Linux distributions only the installation on Debian, Fedora and Gentoo systems is described here. For other distributions, please refer to the documentation or the package management system, if necessary; of course, you can also compile and install Git from source code.

A.1.1. Debian/Ubuntu

Debian and Ubuntu provide ready-to-use packages that can be installed comfortably and quickly with the Debian package management system. The git installation is modularized, so you can install only certain parts of git if necessary.

git

main package, contains core commands (formerly git-core)

git-email

Add-on for sending patches by e-mail

git-gui

Graphical user interface

git-svn

subcommand svn to interact with Subversion repositories

git-cvs

Interaction with CVS

git-doc

documentation (will be installed under /usr/share/doc)

gitk

Program Gitk

There is also a meta-package git-all which installs all relevant packages. So on a regular workstation you should install Git as follows:

$ sudo aptitude install git-all

Under Ubuntu you can install the package git-all via the graphical package manager Synaptic.

A.1.2. Fedora

On a Fedora system, you should install Git using the package manager yum:

$ sudo yum install git

Analogous to the division into smaller packages as in Debian, certain additional features for Git are available in separate packages. To install all commands, you should install the git-all package.

A.1.3. Gentoo

Gentoo provides the ebuild dev-vcs/git. The graphical tool for creating commits (git gui) and the add-on for sending emails (git send-email) are installed by default. If you want to have a graphical user interface for viewing and editing the history (gitk) in addition, enable the USE flag `tk`. If you plan to use the Subversion interface, enable the subversion USE flag. To install via Portage, type the following command:

$ sudo emerge dev-vcs/git

A.1.4. Installation from Sources

If your distribution doesn’t provide a package for Git, it’s outdated, or you don’t have root privileges on the system, you should install Git directly from source.

Git depends on the five libraries expat (XML parser), curl (data transfer), zlib (compression), pcre (regular expressions) and openssl (encryption/hashing). You may need to compile their sources and install the libraries accordingly before proceeding.

First download the tarball of the current Git version⁠[151] and unzip it:

$ wget https://www.kernel.org/pub/software/scm/git/git-2.1.0.tar.gz
$ tar xvf git-2.1.0.tar.gz

Now change to the git-2.1.0/ directory and compile the source code; then run make install:

$ cd git-2.1.0/
$ make -j8
$ make install

With make prefix=<prefix> you can install Git to <prefix> (default: $HOME).

A.2. Mac OS X

The Git for OS X project provides an installation program in disk image format (DMG).⁠[152] So you can install it as usual.

A.3. Windows

The project Git for Windows provides an installation program for Microsoft Windows: msysGit. You can download the program⁠[153] and install it as usual.


151. https://www.kernel.org/pub/software/scm/git/
152. https://code.google.com/p/git-osx-installer/
153. https://gitforwindows.org