Git is an open-source and free management system used to manage small and complex source code and keep track of the changes in projects. It is commonly and mainly used by daily users and programmers to access the codes and revisions.
Git helps in collaborating with other projects. It has unique features such as pull requests and commits attachments with fast speed. In this write-up, we will provide you with the knowledge to install Git in Ubuntu 22.04 with the outcomes as follows:
Let’s start with the default repository’s method:
Method 1: Install Git on Ubuntu 22.04 Through Ubuntu Default Repository
Ubuntu comes with Git packages in its default repository. You can install Git on Ubuntu 22.04 via the official repository. To fulfill this purpose, follow the below-mentioned steps one by one.
Step 1: Update and Upgrade System Packages
Update the core repository of a system to update the packages list:
$ sudo apt update
To upgrade the packages, execute the below script:
$ sudo apt upgrade
The output showed all the packages were upgraded.
Step 2: Install Git
When the packages are updated, you can install “Git” on Ubuntu 22.04 using the following command:
$ sudo apt install git
Git was successfully installed.
Step 3: Verify the Installation of Git
To verify the installed version of Git, execute the below script on an Ubuntu terminal:
$ git --version
The output showed that the version of Git 2.34.1 is installed.
How to Configure Git on Ubuntu 22.04?
After the installation of Git, you can configure it to be used on Ubuntu 22.04. For authentication purposes, add the username and verified email address. By considering it, execute the below script:
$ git config --global user.name "yourname"
To add the user email address, run the following command:
$ git config --global user.email "youremail"
To check the configure list, run the following command in the Ubuntu terminal:
$ git config --list
The output showed that Git had been configured successfully with the user name and email.
Method 2: Install Git on Ubuntu Using the PPA Repository
PPA known as Personal Packages Archives used to distribute the pre-release software for Ubuntu users. To install Git on Ubuntu 22.04 using the PPA repository, follow the step-by-step procedure given as follows:
Step 1: Add PPA Repository of Git
To add the PPA repository to the system’s core packages, execute the following command:
$ sudo add-apt-repository ppa:git-core/ppa
The output showed that the PPA repository was added successfully.
Step 2: Update system packages
To update system packages, execute the below script:
$ sudo apt update
All the packages are up to date.
Step 3: Install Git
Now, install Git using the following command:
$ sudo apt install git
Git was successfully installed.
Step 4: Verify Git Version Installed
To check the installed version of Git on Ubuntu, type and execute the following command in the terminal:
$ git --version
It can be confirmed that the Git 2.36.1 version is installed.
We can conclude here that the PPA repository contains the latest version(2.36.1) while the default repository contains the older version (2.34.1).
We can conclude here that the PPA repository contains the latest version(2.36.1) while the default repository contains the older version (2.34.1).
How to Remove Git From Ubuntu 22.04?
If a user already installed Git on Ubuntu 22.04 through the APT package manager, then the user can remove/uninstall it through the following script:
$ sudo apt remove git
Hit the “Y” key and “Enter” to continue the process. Git is removed from Ubuntu 22.04.
Note: This removal method applies to both installation methods.
Congratulations! You have experienced the installation of various methods of Git on Ubuntu 22.04.
Conclusion
Git can be installed on Ubuntu 22.04 from the Ubuntu official repository or PPA repository using the command “sudo apt install git”. Git is an open-source, cross-platform source code management system that handles small and complex projects. This descriptive write-up illustrated the knowledge to learn how to install Git in Ubuntu 22.04. It is observed that the PPA repository holds the latest version while the default repository has the latest stable release of Git.
TUTORIALS ON LINUX, PROGRAMMING & TECHNOLOGY