Chat Zalo Chat Messenger Phone Number Đăng nhập
How to Update Git on Linux, Windows and MacOS - phoenixNAP

How to Update Git on Linux, Windows and MacOS – phoenixNAP

Introduction

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 gives you the latest features and usability improvements.

In this tutorial, you’ll learn how to update to the latest version

of Git on Linux, Windows, and macOS.

prerequisites

A system running Linux, Windows, or macOS An installed version of Git

  • Accessing the terminal window (Linux, macOS) or command prompt (Windows)
  • An account with administrator-level
  • privileges How to check the current version of Git? To check the

  • current version of Git
  • ,

use the following command:

git -version

This command works on all operating systems. This example uses Windows:

How

to update Git

Below, we list different ways you can upgrade your version of Git, depending on the operating system you’re using. Go to the section for your machine.

Update Git on Linux

This example shows how to update Git on Ubuntu

.

Start by updating the system packages with the following command

: sudo apt-get update Update Git

using

: sudo apt-get install git

When prompted, type Y and press Enter to confirm

the installation.

To verify that the installation is complete, check

the Git version once again: git -version

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

Update Git on Windows

The method you use to update Git on Windows depends on the version of Git you

are currently running.

For versions earlier than 2.14.1, uninstall Git from your system and install a copy of the latest version from scratch. See our guide to installing Git on Windows for more details.

For versions 2.14.2 through 2.16.1,

use the following command at the command prompt: Updating git For versions 2.16.1 on,

update Git with: git update-git-for-windows

The above output appears when you are running the latest version of

Git. Update Git on Mac The easiest way to update

Git

on

Mac is to use the official installer. Download the installation file from the Git website. Run the installation and follow the installation wizard to update Git to the latest version.

Another method is to update Git using Homebrew. If you don’t already have Homebrew, install it using: /usr

/bin/ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)” Update Homebrew to make sure you have the latest installation packages: brew update Install the latest version of Git with Homebrew: brew install git

If you already have Git installed with Homebrew, upgrade to the latest version with:

brew upgrade git

Check

the current version of Git to confirm the update: git -version

Conclusion

After following this tutorial, you should have a fully updated version of Git installed on a Linux, Windows, or macOS machine

.

Check out our Git Command Cheat Sheet for a complete introduction on working with Git. If you encounter a Git merge conflict, be sure to read our article How to resolve merge conflicts in Git.

Contact US