Skip to main content

Install Git

Before you start using Git, you have to make it available on your computer. Git can be installed on the most common operating systems like Windows, Mac, and Linux. In fact, Git comes installed by default on most Mac and Linux machines!

Even if Git is already installed, it’s probably a good idea to update to the latest version. You can either install it as a package or via another installer, or download the source code and compile it yourself. You can download Git for free from the following website: https://www.git-scm.com/

note

git-scm is a popular and recommended resource for downloading Git


Checking for Git

To see if you already have Git installed, open up your terminal application.

  • If you're on a Mac, look for a command prompt application called "Terminal".
  • If you're on a Windows machine, open the windows command prompt or "Git Bash".

Once you've opened your terminal application, type git version. The output will either tell you which version of Git is installed, or it will alert you that git is an unknown command. It should show something like git version X.Y if Git is installed.

If git is alerted as an unknown command, read further and find out how to install Git.


Installing Git on Linux

You can install Git on Linux through the package management tool that comes with your distribution.

If you’re on Fedora (or any closely-related RPM-based distribution, such as RHEL or CentOS), you can use dnf:

$ sudo dnf install git-all

If you’re on a Debian-based distribution, such as Ubuntu, try apt:

$ sudo apt install git-all

Once the command output has completed, you can verify the installation by typing: git version. For more options, there are instructions for installing on several different Unix distributions on the Git website, at https://git-scm.com/download/linux.


Installing Git on macOS

Most versions of macOS will already have Git installed, and you can activate it through the terminal with git version. However, if you don't have Git installed for whatever reason, you can install the latest version of Git using one of several popular methods as listed below:

  • Homebrew

Install homebrew if you don't already have it, then:

$ brew install git

  • Xcode

Apple ships a binary package of Git with Xcode.

  • Binary installer

Tim Harper provides an installer for Git.

  • Building from Source

If you prefer to build from source, you can find tarballs on kernel.org.


Installing Git on Windows

  • Navigate to the latest Git for Windows installer and download the latest version.
  • Once the installer has started, follow the instructions as provided in the Git Setup wizard screen until the installation is complete.
  • Open the windows command prompt (or Git Bash if you selected not to use the standard Git Windows Command Prompt during the Git installation).

Note that this is a project called Git for Windows, which is separate from Git itself; for more information on it, go to https://gitforwindows.org.

To get an automated installation you can use the Git Chocolatey package. Note that the Chocolatey package is community maintained.