Chapter 2. Installing Git

At the time of this writing, Git is (seemingly) not installed by default on any GNU/Linux distribution or any other operating system. So, before you can use Git, you must install it. The steps to install Git depend greatly on the vendor and version of your operating system. This chapter describes how to install Git on Linux and Microsoft Windows and within Cygwin.

Using Linux Binary Distributions

Many Linux vendors provide pre-compiled, binary packages to make installation of new applications, tools, and utilities easy. Each package specifies its dependencies, and the distribution’s package manager typically installs the prerequisites and the desired package in one (well-orchestrated and automated) fell swoop.

Debian/Ubuntu

On most Debian and Ubuntu systems, Git is offered as a collection of packages, where each package can be installed independently depending on your needs. The primary Git package is called git-core, documentation is available in git-doc, and there are other packages to consider, too:

git-arch
git-cvs
git-svn

If you need to transfer a project from Arch, CVS, or Subversion to Git or vice versa, install one or more of these packages.

git-gui
gitk
gitweb

If you prefer to browse repositories in a graphical application or your Web browser, install these as appropriate. git-gui is a Tcl/Tk-based graphical user interface for Git; gitk is another Git browser written in Tcl/Tk but focuses more on visualizing project history. gitweb is written in Perl and displays a Git repository in a browser window.

git-email

This is an essential component if you want to send Git patches through electronic mail, which is a common practice in some projects.

git-daemon-run

To share your repository, install this package. It creates a daemon service that allows you to share your repositories through anonymous download requests.

Because distributions vary greatly, it’s best to search your distribution’s package depot for a complete list of Git-related packages. git-doc and git-email are strongly recommended.

Warning

Debian and Ubuntu provide a package named git, but it isn’t a part of the Git version control system discussed in this book. git is a completely different program called GNU Interactive Tools. Be careful not to install the wrong package by accident!

This command installs the important Git packages by running apt-get as the root:

$ sudo apt-get install git-core git-doc gitweb 
  git-gui gitk git-email git-svn

Other Binary Distributions

To install Git on other Linux distributions, find the appropriate package or packages and use the distribution’s native package manager to install the software.

For example, on Gentoo systems, use emerge:

$ sudo emerge dev-util/git

On Fedora, use yum:

$ sudo yum install git

The Fedora git is roughly equivalent to Debian’s git-core. Other i386 Fedora packages include:

git.i386

The core git tools

git-all.i386

A metapackage for pulling in all Git tools

git-arch.i386

Git tools for importing Arch repositories

git-cvs.i386

Git tools for importing CVS repositories

git-daemon.i386

The Git protocol daemon

git-debuginfo.i386

Debug information for package Git

git-email.i386

Git tools for sending email

git-gui.i386

Git GUI tool

git-svn.i386

Git tools for importing Subversion repositories

gitk.i386

Git revision tree visualizer

Again, be mindful that, like Debian, some distributions may split the Git release among many different packages. If your system lacks a particular Git command, you may need to install an additional package.

Be sure to verify that your distribution’s Git packages are sufficiently up-to-date. After Git is installed on your system, run git --version. If your collaborators use a more modern version of Git, you may have to replace your distribution’s precompiled Git packages with a build of your own. Consult your package manager documentation to learn how to remove previously installed packages; proceed to the next section to learn how to build Git from source.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
52.15.147.20