How to Update Git on Linux, Windows and Mac


Git is a version control system that allows multiple developers to work on the same project while tracking changes and revisions. Keeping Git up to date brings you the latest features, security, and usability improvements.

In this tutorial, you will learn how to update to the latest version of Git on Linux, Windows, and macOS.

How to update Git - a tutorial.


How to Update Git on Linux

Updating Git on Linux is a simple process done using the appropriate package manager for your distribution. The Git commands are the same across distributions, and only the package manager is different.

For Ubuntu and other Debian-based Linux distros, use the apt package manager, and when working with RHEL-based distros, use a package manager such as yum or dnf. In this tutorial, we will use Ubuntu.

Follow the steps below:

1. Run the apt command below to update the system package repository information:

sudo apt update

2. Update Git by running:

sudo apt install git
Updating Git on Linux Ubuntu.

In the example above, the latest Git version is already installed so the system makes no changes.

3. To verify the installation has completed successfully, check the Git version:

git --version
Checking Git version on Ubuntu.

Another way to update Git on Linux is to install it from scratch using the original source code. Check out our guide to installing Git on Ubuntu for details.

How to Update Git on Windows

Git provides a simple, automated way of updating on Windows by running a single command.

Note: If you are using an old Git version (2.14.1 or below), the only way to update Git is to uninstall it from your system and install the latest version. Check out our guide for installing Git on Windows for more details.

Follow the steps below to update Git on Windows:

1. Open the Command Prompt or Windows PowerShell and run the following command to update Git:

git update-git-for-windows
Updating Git on Windows.

The command automatically downloads the latest Git version and starts the installer, which completes the process:

Windows installer updating Git.

2. After the process completes, you have the latest Git version. Check the version with the following command:

git --version
Checking Git version on Windows.

How to Update Git on Mac

To update Git on macOS, follow the steps below:

1. Updating Git is the easiest with Homebrew, a macOS package manager. To install Homebrew, run the following command:

/usr/bin/ruby -e "$(curl -fsSL"

If you already have Homebrew, update it to ensure you get the latest Git version:

brew update

2. Install the latest Git version by running:

brew install git

The command installs the latest Git version available for your system.

Installing Git with Homebrew on Mac.

Wait for the installation to finish, then open a new terminal window.

3. Check the Git version with:

git --version

If the command output shows the latest Git version without apple in the version details, you have completed the update process.

The command output showing the latest Homebrew Git version.

However, if you still see the apple version, the system has retained the previous Git version and is still using it by default. In that case, move on to the next step.

4. Run the command below to manually set the path to the Homebrew Git installation instead of the Apple one:

export PATH=/usr/local/bin:$PATH

5. Check the Git version again to verify it has been updated to the latest one:

git --version


After following this tutorial, you should have an updated version of Git installed on your Linux, Windows, or macOS system. This process ensures access to the newest features, bug fixes, and security patches, enhancing overall efficiency and reducing potential vulnerabilities in version control workflows.

Next, take a look at our Git commands cheat sheet for a comprehensive primer on working with Git. If you come across a Git merge conflict, see how to resolve merge conflicts in Git.

Was this article helpful?
Bosko Marijan
Having worked as an educator and content writer, combined with his lifelong passion for all things high-tech, Bosko strives to simplify intricate concepts and make them user-friendly. That has led him to technical writing at PhoenixNAP, where he continues his mission of spreading knowledge.
Next you should read
Git Commands Cheat Sheet
March 10, 2020

Git, the popular version control system, has a plethora of commands for managing your project history. This article lists out all the important commands every developer will need at some point.
Read more
How to Delete a Git Branch Remotely and Locally
October 13, 2020

This article provides a quick overview of basic commands and processes necessary for deleting both local and remote Git branches.
Read more
How To Switch Branch on Git
September 20, 2023

Developers need to switch between branches frequently. Git branches allow you to work on your code, fix bugs, or develop new features in a way that does not affect applications running in production.
Read more
How To Unstage Files on Git
September 15, 2020

Unstaging in Git means removing queued changes from the index. This guide covers several different ways to unstage changes.
Read more