How to Install Git on Linux Machines

Logo_GitHub

GitHub is an internet hosting service for software development and version control using Git. Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency. Git development began in April 2005 and Development of the GitHub.com platform began on October 19, 2007. In this article, we will discuss the stepwise method of how to install Git on the Linux operating system such as laptops or desktops.

Here the Ubuntu OS Version is 20.04.5 LTS, 64-bit. Follow the steps mentioned below to install and configure Git on Linux machines. Click the link or article below to know how to install Git on Windows Machine.

How to Install Git on Windows Machines

Prerequisite

Below are the recommended prerequisite before starting the installation of Git on the machine.

  • Make sure the Latest Linux operating system is installed (recommended)
  • The machine (Laptop/desktop) has an internet connection
  • A terminal session is working without any error.
  • If possible, install notepad ++, that will be really helpful

Installation

Step1: Terminal
Open terminal to execute commands for installation.

Step2: Install Command
When terminal is opened, run the below mentioned command to install git.

sudo apt-get install git

Step3: Sudo Password
Use the Sudo username and password for elevated access to start installation.

edledge-Ubuntu_20.04.5_LTS:~$ sudo apt-get install git
[sudo] password for edledge-Ubuntu_20.04.5_LTS:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
chromium-codecs-ffmpeg-extra gstreamer1.0-vaapi libfwupdplugin1
libgstreamer-plugins-bad1.0-0 libva-wayland2 libxmlb1
linux-headers-5.13.0-41-generic linux-hwe-5.13-headers-5.13.0-41
linux-image-5.13.0-41-generic linux-modules-5.13.0-41-generic
linux-modules-extra-5.13.0-41-generic
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
git-man liberror-perl
Suggested packages:
git-daemon-run | git-daemon-sysvinit git-doc git-el git-email git-gui gitk
gitweb git-cvs git-mediawiki git-svn
The following NEW packages will be installed:
git git-man liberror-perl
0 upgraded, 3 newly installed, 0 to remove and 92 not upgraded.
Need to get 5,451 kB of archives.
After this operation, 38.5 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://in.archive.ubuntu.com/ubuntu focal/main amd64 liberror-perl all 0.17029-1 [26.5 kB]
Get:2 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 git-man all 1:2.25.1-1ubuntu3.8 [886 kB]
Get:3 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 git amd64 1:2.25.1-1ubuntu3.8 [4,538 kB]
Fetched 5,451 kB in 4s (1,443 kB/s)
Selecting previously unselected package liberror-perl.
(Reading database ... 220997 files and directories currently installed.)
Preparing to unpack .../liberror-perl_0.17029-1_all.deb ...
Unpacking liberror-perl (0.17029-1) ...
Selecting previously unselected package git-man.
Preparing to unpack .../git-man_1%3a2.25.1-1ubuntu3.8_all.deb ...
Unpacking git-man (1:2.25.1-1ubuntu3.8) ...
Selecting previously unselected package git.
Preparing to unpack .../git_1%3a2.25.1-1ubuntu3.8_amd64.deb ...
Unpacking git (1:2.25.1-1ubuntu3.8) ...
Setting up liberror-perl (0.17029-1) ...
Setting up git-man (1:2.25.1-1ubuntu3.8) ...
Setting up git (1:2.25.1-1ubuntu3.8) ...
Processing triggers for man-db (2.9.1-1) ...
edledge-Ubuntu_20.04.5_LTS:~$

Step4: Confirm Git
Confirm the location of the installed file once the Git installation has been completed. To know the location of the installed git, use the command shown below.

edledge-Ubuntu_20.04.5_LTS:~$ whereis git
git: /usr/bin/git /usr/share/man/man1/git.1.gz

Step5: Git Version
To confirm the Git Version, use the command shown below.

edledge-Ubuntu_20.04.5_LTS:~$ git --version
git version 2.25.1

Step6: Username
You could configure the username either for all repositories (use “- -global” for that) or if you just want to use it for this repository then omit – -global.

edledge-Ubuntu_20.04.5_LTS:~$ git config --global user.name "edledge"

Step7: Confirm Username
Use the command mentioned below to confirm the username.

edledge-Ubuntu_20.04.5_LTS:~$ git config --list
user.name=edledge

Git has been installed and configured in the linux machine for the user name “edledge” and is ready to use.

Other important topics

SourceKnowledge Base, Internet, Github

EA00130

Leave a Reply

Your email address will not be published. Required fields are marked *