Git/Obtaining Git

From Wikibooks, open books for an open world
< Git(Redirected from Source Control Management With Git/Obtaining Git)
Jump to: navigation, search

Git is available for *nix operating systems, as well as MacOS and Windows. You can get git by compiling the source code, or by installing pre-compiled binaries. Since git is under rapid development, it is recommended to install the most recent stable binary, or install from a recent stable snapshot of the source code.

Contents

[edit] Binary

Be aware that git is under fast development, and most Linux distributions freeze at a time inconvenient for their upstream components. For instance the git in Ubuntu 10.10 is v1.7.1. Superpackage and submodule functionality was first introduced in git v1.5.3.

[edit] *nixes

[edit] Debian-based distributions (.deb)

Git is available on Debian, and derivatives like Ubuntu. It is currently packaged as git. More recent packages of git are available from the Ubuntu Git Maintainers' PPA. You may also want to install some extended git functionality, for example git-svn, which allows two-way interoperability with Subversion, or git-email which provides utility functions for sending and receiving git data (primarily patches) via email.

$ sudo apt-get install git git-svn git-email

[edit] RPM-based distributions (.rpm)

Linux distributions using the RPM package format can use yum to get git:

$ sudo yum install git-core

[edit] MacOS

A graphical installer can be found at Google code. Alternative, if you have MacPorts installed, you can do

$ sudo port install git-core

[edit] Windows

Git for Windows is available as a precompiled binary msysGit. This includes the command line utilities, a GUI, and an SSH client.

Additionally, those with Cygwin can use its setup to obtain Git.

[edit] Source

[edit] Tarball

You can obtain a copy of the newest stable git from the git homepage at: git.or.cz. In addition, daily snapshots of git are provided by Dave Jones.

Below is an example of how to compile git from source, change "git-1.5.3.4.tar.gz" to the version you downloaded:

mkdir ~/src
cd ~/src
wget http://kernel.org/pub/software/scm/git/git-1.5.3.4.tar.gz
tar xzvf git-1.5.3.4.tar.gz
cd git-1.5.3.4
make configure
./configure --prefix=/usr/local
make
sudo make install

Without the added --prefix argument git will currently install to ~/bin. This may or may not be what you want, in most distributions ~/bin is not in the $PATH.[1] Without the --prefix, you might have to explicitly state the path to the component programs on invocation, i.e.: ~/bin/git-add foobar. You can set --prefix to whatever better suits your particular setup.

[edit] Git

The source can additionally be acquired via git using:

$ git clone git://git.kernel.org/pub/scm/git/git.git

Or in the event you have problems with the default Git port of 9418:

$ git clone http://www.kernel.org/pub/scm/git/git.git

[edit] Footnotes

  1. ^ One effort to amend the lack of consistency through modern distributions and ~/bin, has been addressed by the Ubuntu developers which seeks to patch PAM, the authentication mechanism, to set up the environmental variable $PATH. You can find more information out about this at https://bugs.launchpad.net/ubuntu/+source/pam/+bug/64064.
Personal tools
Namespaces
Variants
Actions
Navigation
Community
Toolbox
Sister projects
Print/export