Now that you understand the fundamentals of version control and the benefits of Git's distributed model, the next step is to get Git running on your computer. If you are using a Linux system, the installation process is typically straightforward using your distribution's built-in package manager.
Linux distributions vary, but most fall into families that use specific package management systems. We will cover the most common ones.
If your Linux distribution is based on Debian (like Ubuntu, Linux Mint, Pop!_OS, etc.), it likely uses the Advanced Package Tool (APT).
Update your package list: Before installing new software, it's good practice to make sure your system's list of available packages is up to date. Open your terminal and run:
sudo apt update
You might be prompted for your password. The sudo
command temporarily grants administrative privileges necessary for managing system software.
Install Git: Once the package list is updated, you can install Git with the following command:
sudo apt install git
APT will calculate dependencies, ask for confirmation (usually by typing Y
), download the necessary files, and install Git on your system.
For distributions in the Red Hat family (like Fedora, CentOS Stream, Rocky Linux, AlmaLinux, or Red Hat Enterprise Linux), you will use either dnf
(newer systems like Fedora, RHEL 8+) or yum
(older systems like CentOS 7). The commands are very similar.
Update your packages (Optional but recommended): You can update your system packages first.
For dnf
:
sudo dnf update
For yum
:
sudo yum update
Again, sudo
provides the necessary permissions, and you might be asked for your password.
Install Git:
For dnf
:
sudo dnf install git
For yum
:
sudo yum install git
Like APT, these package managers will handle dependencies and prompt for confirmation before installing Git.
Regardless of the method used, you can verify that Git was installed correctly by asking it to report its version. Open a terminal and type:
git --version
If the installation was successful, you will see output similar to this (the specific version number may differ):
git version 2.40.1
Seeing a version number confirms that Git is installed and accessible from your command line.
While using a package manager is the recommended approach for most users, you can also compile and install Git directly from its source code. This guarantees you have the absolute latest version but is a more involved process. Instructions for building from source are available on the official Git website (https://git-scm.com/). For this introductory course, the package manager method is sufficient.
With Git installed, the next step is to perform some initial configuration to identify yourself as the author of your future changes. We will cover this in the next section.
© 2025 ApX Machine Learning