How to install Git on
any operating system Git
can be installed on the most common operating systems such as Windows, Mac, and Linux. In fact, Git comes installed by default on most Mac and Linux machines!
Checking Git
To see if you already have Git installed, open your terminal application.
If you’re on a
- Mac, look for a command prompt app called “Terminal.” If you are on a
- machine, open the Windows command prompt or “Git Bash”.
Windows
Once you have opened your terminal application, type git version. The output will tell you which version of Git is installed or alert you that git is an unknown command. If this is an unknown command, read more and find out how to install Git.
Install Git using
GitHub Desktop
Installing GitHub Desktop will also install the latest version of Git if you don’t already have it. With GitHub Desktop, you get a command-line version of Git with a robust GUI. Regardless of whether you have Git installed or not, GitHub Desktop offers a simple collaboration tool for Git. You can learn more here.
Install
Git on Windows Go to the latest Git installer for Windows
- and download the latest version
- Once the installer is launched, follow the instructions provided on the Git setup wizard screen until the installation is complete.
- (or Git Bash if you selected not to use the standard Git command prompt for Windows during Git installation).
- Type git version to verify that Git was installed.
.
Open the Windows command prompt
Note: git-scm is a popular and recommended resource for downloading Git for Windows. The advantage of downloading Git from git-scm is that its download starts automatically with the latest version of Git included with the recommended command prompt, Git Bash. The download source is the same Git installer for Windows referenced in the previous steps.
Install Git
on Mac
Most versions of MacOS will already have Git installed, and you can activate it through the terminal with the git version. However, if you don’t have Git installed for any reason, you can install the latest version of Git using one of several popular methods listed below:
Install Git
from an
installer Navigate to the latest
- macOS Git installer and download the latest version
- Once the installer has launched, follow the instructions provided until the installation is complete
- Open the “terminal” command prompt and type git version to verify that Git was installed.
.
.
Note: git-scm is a popular and recommended resource for downloading Git on a Mac. The advantage of downloading Git from git-scm is that your download automatically starts with the latest version of Git. The download source is the same macOS Git installer referenced in the previous steps.
Install Git from
Homebrew
Homebrew is a popular package manager for macOS. If you already have Homwbrew installed, you can follow the steps below to
install Git:
- Open a terminal window and install Git using the following command: brew install git
- Once the command output is complete, you can verify the installation by typing: git version.
.
Install
Git on Linux
Fun fact: Git was originally developed to version the Linux operating system! So, it only makes sense that it’s easy to set up to run on Linux.
You can install Git on Linux through the package management tool that comes with your distribution.
Debian/Ubuntu
Git packages
- are available using apt
- It’s a good idea to make sure you’re running the latest version. To do so, navigate to your command prompt shell and run the following command to make sure everything is up to date: sudo apt-get update.
- To install Git, run the following command: sudo apt-get install git-all.
- Once the command output is complete, you can verify the installation by typing: git version.
.
Fedora
Git packages
- are available using
- To install Git, navigate to the Command Prompt shell and run the following command: sudo dnf install git-all
- Once the command output is complete, you can verify the installation by typing: git version.
dnf.
.
Note: You can download the appropriate versions of Git and read more about installing on specific Linux systems, such as installing Git on Ubuntu or Fedora, in the git-scm documentation.
Other Git
installation methods
Looking to install Git via source code? Learn more here.
Contribute to this article on GitHub.