PopOS

How to Install Git on Pop!_OS

Git is a free platform designed to manage and develop app development projects. The platform is accessible to every user so the community can share solutions to other users’ issues.

The standard for version control systems allows distribution, collaboration with other developers, creating branches, reverting to previous stages, tracking code changes, etc. It is available for almost every Linux distro. This tutorial will describe how to install Git on Pop!_OS.

How To Install Git on Pop!_OS

Here, we will explain several methods to install Git on Pop!_OS from the default package, the official PPA, and the source. All these three methods provide different benefits depending on the specific requirements.

Using Ubuntu Repositories

Along with different default packages, official Ubuntu repositories also host third-party software like Git. You can install Git with ease, reliability, and compatibility from the official repository.

First, make sure to update the by running the following command:

sudo apt update && sudo apt upgrade

By default, Git is available on the Ubuntu repository. So you can easily install it on Pop!_OS by using the following command:

sudo apt install git

To install all its available features, run the following command:

sudo apt-get install git-all -y

The previous command takes time to run since the packages are extensive. After the successful installation, you can check its installed version using the following command:

git --version

Using Official PPA

With the official PPA, you can install its latest version, which sometimes does not happen with the help of default packages.

We downloaded version 2.34 of the Git in its default package through the official repository. Now, we will install its latest stable version with the help of the official PPA.

First of all, add the Git PPA repository with the following command:

sudo add-apt-repository ppa:git-core/ppa

Press Enter to continue the process.

To refresh the APT cache, run the update command:

sudo apt update

Now, just run the following install command to install Git on your Pop!_OS:

sudo apt install git -y

To verify its successful installation, check the installed version of Git.

git - - version

You can see from the previous output that the Git has been updated to the latest stable version.

Install Git From Source

Compiling the Git directly from the source is a flexible method of its installation. Of course, this method takes more time to install the Git, but you can download its latest release through this. Also, you can have more control over the options by customizing them according to your needs.

First of all, check the current version of Git available on Pop!_OS with the following command:

git –version

As you can see, the version of the Git installed in your system is not its latest version. You can check the Git version available on the source with the following command:

apt-cache policy git

To install the latest version of Git, please install the software that it depends on, and it has to be installed from the default repository. So first update the local package index:

sudo apt update

Now, you can install the software package by using the following command:

After successfully installing the required dependencies, create a temporary directory and go to it with the help of the following command. It is in this directory that we will download the Git tarball.

mkdir tmp

cd /tmp

Go to the Git project website, navigate the tarball list, and download the latest version of Git. Afterward, output the downloaded file using the curl command.

curl -o git.tar.gz https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.9.5.tar.xz

Unpack the above-compressed tarball file.

tar -zxf git.tar.gz

Move it into the newly created directory.

cd git-*

Build the package and install it using the following commands:

make prefix=/usr/local all

sudo make prefix=/usr/local install

Change the shell process to use the latest installed version of Git.

exec bash

Finally, check the version of Git to verify successful installation.

git --version

It has been updated to the latest version.

Configure Git on Pop!_OS

Configure Git by running the following command with the email and name of the user in Pop!_OS.

git config --global user.name "username"

git config --global user.email "emailid"

List the global Git settings to verify its configuration through the following command:

git config --list

You can further configure Git and edit the configuration file using the nano editor with the following command:

sudo nano ~/.gitconfig

Also, you can get information by running the following command to configure Git further:

git config

Conclusion

This tutorial explains the different approaches to installing Git on Pop!_OS. We installed Git from Ubuntu repositories, official PPAs, and the direct source.

Using the Ubuntu repository method, you can install the version of Git that is available in its default package but not necessarily the latest version. After installing Git, it is also very easy to configure it, which we briefly described at the end of this tutorial.

About the author

Prateek Jangid

A passionate Linux user for personal and professional reasons, always exploring what is new in the world of Linux and sharing with my readers.