Git/Obtaining Git

From Wikibooks, open books for an open world
< Git
Jump to navigation Jump to search

Git is available for *nix operating systems, as well as MacOS and Windows.

Binary[edit | edit source]

Linux[edit | edit source]

Debian-based distributions (.deb)[edit | edit source]

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

RPM-based distributions (.rpm)[edit | edit source]

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

$ sudo yum install git-core

macOS[edit | edit source]

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

$ sudo port install git-core

git is also included in the package:

pkgutil --file-info `which git`
volume: /
path: /usr/bin/git

install-time: 1526062261
uid: 0
gid: 0
mode: 755

Windows[edit | edit source]

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.

Source[edit | edit source]

Tarball[edit | edit source]

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

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

mkdir ~/src
cd ~/src
tar xzvf git-
cd git-
make configure
./configure --prefix=/usr/local
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.

Git[edit | edit source]

The source can additionally be acquired via git using:

$ git clone git://

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

$ git clone

First configuration[edit | edit source]

To avoid to reenter one's credential during each sync, register the account:

git config --global ""
git config --global "Michael Boudran"

To check the config:

 git config -l

To avoid the password in Linux, it's necessary to store it in plain text into:

vim ~/.netrc

With (ex: for

      login <user>
      password <password>

Please note that GitHub no longer use's Username and Password for authentication since September 2021. Instead, GitHub uses Authentication Tokens generated on A replacement for the above example would be:

      login <user>
      password <token>

Other Git clients[edit | edit source]

NetBeans commit.

Some integrated development environments like NetBeans or PhpStorm also provide or complete Git client.

TortoiseGit allows to access to its Git commands by right-clicking on the concerned files and folders.

TortoiseGit quick options.

Footnotes[edit | edit source]

  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