Ubuntu systems need the git command before they can clone repositories, create commits, fetch changes, or run development workflows that depend on version control from the shell.

The supported package-manager path is the git package from the active Ubuntu repositories. That package installs the command-line client plus manual pages and runtime dependencies through APT, so future security and maintenance updates come through the same update mechanism as the rest of the system.

The packaged version is tied to the Ubuntu release. Use the repository package when the goal is a maintained Git client on an Ubuntu desktop, server, container, or VM; use a newer upstream source only when a specific Git feature is missing from the distro package.

Step-by-step video guide:

Steps to install Git on Ubuntu:

  1. Open a terminal with sudo privileges.
  2. Refresh the APT package index.
    $ sudo apt update
  3. Install the Git client package.
    $ sudo apt install --assume-yes git

    The git package also pulls in package dependencies such as git-man for manual pages. Minimal server or container installs may also add supporting packages such as certificates, OpenSSH client files, and Perl libraries.

  4. Confirm the installed command runs.
    $ git --version
    git version 2.53.0

    The exact version depends on the Ubuntu release and enabled update pocket. A successful install returns a git version line instead of command not found.

  5. Confirm APT knows about the installed package when package provenance matters.
    $ dpkg-query -W git
    git	1:2.53.0-1ubuntu1

    This confirms the active system installed the Ubuntu git package. Related: How to list effective Git configuration

  6. Configure a Git author identity before creating commits on a new user account.