How to Install Git on Linux, Mac or Windows
Updated by Linode
Introduction to Git
Git was designed and developed by Linus Torvalds for Linux kernel development. Git provides support for non-linear, distributed development, allowing multiple contributors to work on a project simultaneously. Git is the most popular distributed version control and source code management system.
This guide explains how to install the latest, stable, prepackaged version
git on GNU/Linux, Mac Osx, and Windows, using their respective package managers. Git can also be compiled from source and installed on any operating system.
For more information about using and configuring Git, see our Getting Started with Git guide.
NoteThis guide will use
sudowherever possible. Complete the sections of our Securing Your Server to create a standard user account.
Install Git on Linux
Debian and Ubuntu:
sudo apt-get install git
sudo yum install git
sudo yum install git-core
sudo pacman -Sy git
sudo emerge --ask --verbose dev-vcs/git
Install Git on Mac OS
There are different ways to install Git on Mac OS. You can install Git using Homebrew, MacPorts, or by downloading the Git installer package.
Install Git via Homebrew
If Homebrew is already installed, begin with Step 6.
- Go to the Homebrew website.
Copy and paste the command on that page, under Install Homebrew into a terminal window:
At the next prompt enter your password and hit Return:
You will receive an installation successful message when complete:
To help diagnose Homebrew errors, install Brew Doctor before installing Git:
brew install git
Install Git via MacPorts
If MacPorts is already installed, proceed directly to Step 9.
- Go to MacPorts website.
- Click on the link for your operating system.
- After the download completes, click on the file to start the installer.
Click the Continue button to begin the install:
Click Agree to accept the license agreement:
To leave the default installation location click Install, or to change the default installation location, click Change Install Location:
Enter your password when prompted and click Install Software:
After the installation completes, click Close to exit the installer:
Open a terminal window.
sudo port install git +svn +doc +bash_completion +gitweb
Install Git via Package Installer
- Go to the Git website and download the current installer for your operating system.
- Double click on the downloaded file to begin the install.
Click on the Continue button to begin the install:
Select Install for all users of this computer and click Continue to begin the installation:
If you need to change the installation location click Change Install Location button. Click Install to continue with the default location:
Enter your username and password and click Install Software to continue:
Click the Close button to exit the installer:
Install Git on Windows
To install Git on Windows you will need to download the installer from the Git website:
Download the most current version for your operating system by double clicking on the package name:
Select Run to begin the installation:
Click Yes to continue:
Click Next to continue:
Click Next to continue:
If you need to change the installation folder, click Browse and select a new location. To accept the default location click on Next:
To accept the default components to be installed click Next. Otherwise, select the additional components to be installed before clicking the Next button:
Accept the default Start Menu folder by clicking Next, or use Browse to select a new folder location:
Keep the default line ending conversion by clicking Next. To change the default, choose one of the two other choices before clicking Next:
NoteIt is strongly recommended that you keep the default settings for line ending conversions. Changing from the default may result in formatting problems when viewed on your Linode.
The program will now begin installing:
Click Finish to exit the installer:
Once you open Git you can select either Create New, Clone Existing or Open Existing Repository. In this example, we create new repository:
Enter a directory name or click on Browse to navigate to a directory:
A blank repository is created:
Get Started with Git
Visit our guide on Git configuration for helpful commands to get you started with Git and repositories.
You may wish to consult the following resources for additional information on this topic. While these are provided in the hope that they will be useful, please note that we cannot vouch for the accuracy or timeliness of externally hosted materials.
- How to Install Git and Clone a GitHub Repository
- Getting Started with Git
- Git Based Development Networks with Girocco on Debian 5 (Lenny) - Deprecated
- Manage Distributed Version Control with Mercurial
- Manage Distributed Source Branches with Bazaar
This guide is published under a CC BY-ND 4.0 license.