1 Installing Git

You can install Git in several different ways: by using one of the GUI installers, by using a package management system, or, in the time-honored Linux tradition that spawned Git, by compiling it from source.

Don’t worry if you’re not ready to start compiling software; all major operating systems provide alternatives to compiling Git yourself. For example, Ubuntu provides Git via its apt-get tool, so a few commands from the terminal are enough to get you going. Likewise, OS X users have the option of using MacPorts[5] or the new Homebrew[6] to handle the installation. Not to be left out, Windows users who use Cygwin[7] can also install it via Cygwin’s setup.exe.

Windows and OS X users who prefer GUI installations have alternatives available as well. Windows users can use the msysGit[8] installer to get up and running, and OS X users can install Git using the Git OS X Installer[9] to install Git via a DMG.

The original way to install Git, which is still the best if you want to remain on the latest version, is to build it from source. The various dependencies can be hard to track down, especially if you plan on building the user manual. Tools like apt-get build-dep on Ubuntu are helpful for tracking down all of the dependencies.

Watch mixing installation tools. For example, if you use a Mac and have installed most of your software using MacPorts, stick with MacPorts; if you compile all your own software on Linux, now probably isn’t the time to start using apt-get. Switching to Git provides you with enough learning opportunities, so be careful to guard that installing Git doesn’t cause the yak to get a trim.[10]

What To Do...
  • Compile Git from its source code.

    Download the latest tarball from the Git website.[4]

     
    prompt>​ tar -xjf git-YOUR-VERSION.tar.bz2
     
    prompt>​ cd git-YOUR-VERSION
     
    prompt>​ make
     
    prompt>​ make install

    You can compile the documentation from source as well. Replace the last two lines in the previous steps with this:

     
    prompt>​ make all doc
     
    prompt>​ make install install-doc
  • Install Git on Ubuntu.
     
    prompt>​ sudo apt-get install git-core

    To install the user manual, do this:

     
    prompt>​ sudo apt-get install git-doc

    To install the Git to Subversion functionality, do this:

     
    prompt>​ sudo apt-get install git-svn

    You can use apt-get to handle all of the dependencies and then compile Git from source using the previous steps.

     
    prompt>​ sudo apt-get build-dep git-core git-doc git-svn
  • Install Git on OS X.

    You can use MacPorts and install Git with SVN functionality:

     
    prompt>​ sudo port install git-core +svn

    There is also a Git Installer for OS X available on Google Code.

  • Install on Windows.

    Download latest msysGit installer from here:

     
    http://code.google.com/p/msysgit/

    Or, install as part of Cygwin’s setup process.

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

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