Install Git in Ubuntu

How to Install Git in Ubuntu and Configure it

There are several ways and interface to install Git in Ubuntu server. One of the most popular version control system is Git where you can handle any projects efficiently.

Let’s guide you with the process in simple steps to Install Git in Ubuntu and Configure it

Git
Image Source: Github

 

What is Git?

Git is a popular version control distributed system that is most used for development work, helping developers track changes in their code, collaborate with others, and manage project history efficiently. Install git in Ubuntu is simple and straight forward can be done using a few simple commands

 

Requirements:

  • Terminal Access – Your system need terminal window to enter the git Installation commands
  • User Account With Sudo Privileges – You need an account with root user privileges or an admin user privilege that you can perform the installation.
  • Ubuntu Version – Please make sure the Ubuntu version is the latest on your system.

 

Steps to Install Git in Ubuntu:

Method 1: Using APT

Step 1: Update the repository.

sudo apt-get update

Step 2: Install git in Ubuntu with this command

sudo apt Install git -y

The -y will skip the asking confirmation for installation

 

Step 3: With Below command, you can check the version of the git installation.

git --version

 

Method 2: Update to latest version from Source

Step 1: Update the repository by running the following command.

sudo apt-get update

 

Step 2: Install the necessary Github packages using the below command.

sudo apt-get install libcurl4-gnutls-dev libexpat1-dev gettext libz-dev libssl-dev build-essential

Step 3: Download the Git source code

wget https://www.kernel.org/pub/software/scm/git/git-2.36.1.tar.gz

Note: Replace the 2.x.x with the latest version

 

Step 4: Extracting the files using the below tar command.

tar -zxf git-2.36.1.tar.gz

Once the file has been extracted, you can use the below command to change of the git directory

cd git-2.36.1

 

Step 5: Install git in Ubuntu by locally using the command.

make prefix=/usr install install-doc install-html install-info

 

Step 6: To cross check the installation version, use the below command.

git –-version

 

Configure the Git Command:

Step 1: Using the below command to configure the git

git config –global user.name “user_name”

Replace the usernmae with your actual git account username

 

Step 2: Using the below command to set the email account.

git config --global user.email "youremail@domain.tld"

Replace the youremail@domain.tld with your actual email that you want to setup

 

Step 3: To remove the Git installation use the below command.

Sudo apt remove git

 

Other Relevant Sources:

1. What is GitHub and how to use it?

2. Setup Git With Plesk?

3. Common Git Commands

 

Hope this article helps you Install git in Ubuntu with latest version and configure with the necessary packages.