Install Git
On this page, you will find useful information about Git installation learning how to install Git from source; how to install it on Mac, Windows and Linux.
Working with Git starts with installing or updating it, if you already have it on your computer. On this page, you will find how to install Git on Windows, Linux and Mac.

How to Install Git on Mac
There are three ways to install Git on Mac OS X: Git for Mac installer, Homebrew and MacPorts.
Mac Installer
This is the simplest way of installing Git on Mac. Here are the steps to follow:
- Download the latest Git for Mac installer.
- Follow the given instructions to finish installing.
- Open the terminal and type git --version to verify that the installation was successful.
git --version
git version 2.9.2- Enter your Git username and email as given in the example below:
Install Git on Mac
git config --global user.name "BobSmith001"
git config --global user.email "[email protected]"Homebrew
Install Homebrew on Mac and then follow the steps below to install Git with it:
- Open your terminal and install Git with Homebrew.
Installing Git via Homebrew
brew install git- Type git --version to verify that the installation was successful.
Install Git with Homebrew
git --version
git version 2.9.2- You need to enter your Git username and email as given in the example below:
Setting Git username and email
git config --global user.name "BobSmith001"
git config --global user.email "[email protected]"MacPorts
Follow these instructions to install Git with MacPorts:
- Update MacPorts:
Install Git with MacPorts
sudo port selfupdate- Now you need to search the most recent Git ports and variants:
Install Git
port search git
port variants git- The installation of Git should include bash completion, the OS X keychain helper, and the docs:
Installing Git with OS X keychain helper
sudo port install git +bash_completion +credential_osxkeychain +doc- You need to configure your Git username and email as given in the example below:
Install Git
git config --global user.name "BobSmith001"
git config --global user.email "[email protected]"How to Install Git on Windows
Find the instructions below to install Git on Windows:
- Download the most recent Git for Windows installer.
- Then, the Git Setup wizard screen will show up and you need to follow the prompts to complete the installation.
- Open a Command Prompt or Git Bash if you’ve selected not to use Git from Windows Command Prompt.
- Configure your Git username and email as given in the example below:
Install Git on Windows
git config --global user.name "BobSmith001"
git config --global user.email "[email protected]"How to Install Git on Linux
Debian / Ubuntu ( apt-get )
You can find Git packages via APT. Here are the steps to follow:
- Install Git from your shell with apt-get:
Install Git on Linux
sudo apt-get update
sudo apt-get install git- Type git --version to verify that the installation has succeeded:
git --version
git --version
git version 2.9.2- Enter your Git username and email as given in the example below:
Install Git
git config --global user.name "BobSmith001"
git config --global user.email "[email protected]"Fedora (dnf/yum)
Git packages are available via dnf. (Note: yum is deprecated in modern Fedora.)
- Install Git using dnf:
Install Git via dnf
sudo dnf install git- Type git --version to verify that the installation was successful.
Check git version
git --version
git version 2.9.2- Configure your Git username and email as given in the example below:
Install Git
git config --global user.name "BobSmith001"
git config --global user.email "[email protected]"How to Install Git From Source on Linux
Installing Git from source is preferable, as you can always get the latest version. You need the following libraries to install Git from source: curl, zlib, openssl, expat and libiconv. For those who use a system that has dnf or apt-get, the two commands below can be useful for installing all of the dependencies:
Note that you will need the following additional dependencies to be able to add documentation in different formats (doc, HTML, info):
Install Git From Source
sudo yum install curl-devel expat-devel gettext-devel \
openssl-devel zlib-devel perl-devel asciidoc xmltoInstall Git From Source
sudo apt-get install libcurl4-openssl-dev libexpat1-dev gettext \
libz-dev libssl-devInstall Git and add documentation formats
sudo dnf install asciidoc xmlto docbook2X
sudo apt-get install asciidoc xmlto docbook2xCompile and install:
Install Git, Compile and install
tar -zxf git-<version>.tar.gz
cd git-<version>
make prefix=/usr/local all
sudo make prefix=/usr/local installAfter installation, verify that Git is in your PATH by running git --version. If the command is not found, add /usr/local/bin to your PATH environment variable.
You can also fetch the latest source code directly using Git:
Fetching source code
git clone https://github.com/git/git.gitPractice
Which methods can be used to install Git on different operating systems?