How to Install Git on Ubuntu 22.04

How to install Git

In this short guide, we will learn how to install Git on Ubuntu 22.04 operating system.

Introduction

Git is a free and popular platform version control system that is designed to develop and control app development projects. Git is designed to handle multiple project with speed and efficiency from small to very large projects. In this article we will discuss about Git installation on Ubuntu 22.04 and also discuss the basic configuration settings of the Git.

Git Installation Steps On Ubuntu 22.04

In this sub-chapter, we will explain the steps for installing Git in detail, the steps are as follows:

  1. Adding Git PPA to the system
  2. Install the latest version of Git
  3. Verify installed Git
  4. Configuring Git

A more detailed discussion of the items above will be explained in the sub-chapters below.

1. Adding Git PPA to the System

The first thing is to add the Git PPA to our system, this task will be done by submitting command line :

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

Output :

ramans@bckinfo:~$ sudo add-apt-repository ppa:git-core/ppa
[sudo] password for ramans: 
PPA publishes dbgsym, you may need to include 'main/debug' component
Repository: 'deb https://ppa.launchpadcontent.net/git-core/ppa/ubuntu/ jammy main'
Description:
The most current stable version of Git for Ubuntu.

For release candidates, go to https://launchpad.net/~git-core/+archive/candidate .
More info: https://launchpad.net/~git-core/+archive/ubuntu/ppa
Adding repository.
Press [ENTER] to continue or Ctrl-c to cancel.
Adding deb entry to /etc/apt/sources.list.d/git-core-ubuntu-ppa-jammy.list
Adding disabled deb-src entry to /etc/apt/sources.list.d/git-core-ubuntu-ppa-jammy.list
Adding key to /etc/apt/trusted.gpg.d/git-core-ubuntu-ppa.gpg with fingerprint E1DD270288B4E6030699E45FA1715D88E1DF1F24
Hit:1 http://id.archive.ubuntu.com/ubuntu jammy InRelease

. . .

Get:33 http://id.archive.ubuntu.com/ubuntu jammy-backports/universe amd64 DEP-11 Metadata [12,6 kB]
Get:34 http://id.archive.ubuntu.com/ubuntu jammy-backports/universe amd64 c-n-f Metadata [352 B]   
Fetched 4.322 kB in 35s (122 kB/s)                                                                 
Reading package lists... Done  

2. Install the latest version of Git

On this stage, we will install the latest version of the Git client on you Ubuntu system. This task can be done by submitting command lines :

$ sudo apt-get update
$ sudo apt install git

Output :

ramans@bckinfo:~$ sudo apt-get update
Hit:1 https://download.docker.com/linux/ubuntu jammy InRelease
Hit:2 http://id.archive.ubuntu.com/ubuntu jammy InRelease                                          
Hit:3 http://id.archive.ubuntu.com/ubuntu jammy-updates InRelease                                  
Hit:4 http://security.ubuntu.com/ubuntu jammy-security InRelease                                   
Hit:5 http://id.archive.ubuntu.com/ubuntu jammy-backports InRelease                                
Hit:6 https://ppa.launchpadcontent.net/git-core/ppa/ubuntu jammy InRelease       
Reading package lists... Done
ramans@bckinfo:~$ sudo apt install git
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  git-man
Suggested packages:
  git-daemon-run | git-daemon-sysvinit git-doc git-email git-gui gitk gitweb git-cvs git-mediawiki git-svn
The following packages will be upgraded:
  git git-man
2 upgraded, 0 newly installed, 0 to remove and 261 not upgraded.
Need to get 8.161 kB of archives.
After this operation, 11,1 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 https://ppa.launchpadcontent.net/git-core/ppa/ubuntu jammy/main amd64 git amd64 1:2.38.0-0ppa1~ubuntu22.04.1 [6.108 kB]
Get:2 https://ppa.launchpadcontent.net/git-core/ppa/ubuntu jammy/main amd64 git-man all 1:2.38.0-0ppa1~ubuntu22.04.1 [2.053 kB]   
Fetched 8.161 kB in 54s (152 kB/s)                                                                                                
(Reading database ... 199155 files and directories currently installed.)
Preparing to unpack .../git_1%3a2.38.0-0ppa1~ubuntu22.04.1_amd64.deb ...
Unpacking git (1:2.38.0-0ppa1~ubuntu22.04.1) over (1:2.34.1-1ubuntu1.4) ...
Preparing to unpack .../git-man_1%3a2.38.0-0ppa1~ubuntu22.04.1_all.deb ...
Unpacking git-man (1:2.38.0-0ppa1~ubuntu22.04.1) over (1:2.34.1-1ubuntu1.4) ...
Setting up git-man (1:2.38.0-0ppa1~ubuntu22.04.1) ...
Setting up git (1:2.38.0-0ppa1~ubuntu22.04.1) ...
Processing triggers for man-db (2.10.2-1) ...

3. Verify Git Installation

After Git installation was completed done, we will verify it by running the following command.

$ git --version

Output :

ramans@bckinfo:~$ git --version
git version 2.38.0

4. Configuring Git Client on Ubuntu 22.04

To run Git client properly, it is required developer information like Name and Email address. These information will be used by the Git client to attach proper use information with git commits and will be store at Every git user have to set these values once adn will be store at ~/.gitconfig file.

For this purpose we will execute the following commands.

ramans@bckinfo:~$ git config --global user.name "Jack Ramans"
ramans@bckinfo:~$ git config --global user.email "jack.ramans@bckinfo.com"
ramans@bckinfo:~$ git config --list 
user.name=Jack Ramans
user.email=jack.ramans@bckinfo.com

Conclusion

In this short tutorial, we have described how to install Git, a version control, on Ubuntu 22.04.

(Visited 160 times, 1 visits today)

You may also like