How to Install, Update, and Remove Git on Linux (Ubuntu)

Managing software on Linux works a bit differently than downloading an .exe file on Windows. Instead of visiting a website to download an installer, Linux distributions rely on built-in package managers.

Because different Linux distributions (such as Ubuntu, Fedora, or Arch) use different package managers, installation commands vary depending on the operating system. On Ubuntu and other Debian-based systems, software is managed using APT (Advanced Package Tool).

Step 1: Install Git

To install software on Ubuntu, you use the apt install command followed by the package name.

Installing system-level applications requires administrative privileges. If you run the command without elevated permissions, the system will return a Permission denied error. To execute commands as an administrator, preface them with sudo (Superuser Do).

  1. Open your terminal.
  2. Run the following command:

Bash

sudo apt install git
  1. When prompted, enter your administrator password.
  2. Type y and press Enter to confirm the download and complete the installation.

Step 2: Verify the Installation

Confirm Git is installed correctly and check the active version by running:

Bash

git --version

Step 3: Update Git

Package managers keep software up to date by fetching the latest releases directly from software repositories. To update Git to the newest version available:

  1. Update your local package index:

Bash

sudo apt update
  1. Upgrade Git (or reinstall the latest package version):

Bash

sudo apt --only-upgrade install git

Step 4: Remove or Uninstall Git

If you need to remove Git from your Ubuntu system, use the remove option in place of install:

  1. Run the remove command:

Bash

sudo apt remove git
  1. When the terminal asks for confirmation to remove the package and free up disk space, type y and press Enter.
Gemini Generated Image b044bqb044bqb044

Leave a Reply