How to install Git on Debian 8.3

How to install Git on Debian 8.3

Git is a modern version control system. It tracks all the softwares at the source level. With the help of Git you can track changes, revert it back to the previous stages, and create alternate files and directories. This tutorial covers the installation of Git on Debian 8.3.

Installation procedure

To start the installation process, first add the repo in the terminal.

root@linuxhelp:~# nano /etc/apt/sources.list

The source file has been opened. Enter these two lines and save the file.

deb http://ftp.debian.org/debian/ stable main contrib non-free
deb http://ftp.de.debian.org/debian jessie main

Next update to add repo which contains the package using the apt-get update command.

root@linuxhelp:~# apt-get update
Hit http://ftp.debian.org jessie-updates InRelease
Ign http://ftp.de.debian.org jessie InRelease
Ign http://ftp.debian.org stable InRelease                            
Hit http://ftp.de.debian.org jessie Release.gpg
Hit http://ftp.debian.org jessie-updates/main Sources
Hit http://ftp.de.debian.org jessie Release                 
Hit http://ftp.debian.org jessie-updates/contrib Sources
Hit http://ftp.de.debian.org jessie/main amd64 Packages      
Get:1 http://ftp.debian.org jessie-updates/main amd64 Packages/DiffIndex [7,408 B]
Hit http://ftp.de.debian.org jessie/main i386 Packages                  
Hit http://ftp.debian.org jessie-updates/contrib amd64 Packages   
Hit http://ftp.de.debian.org jessie/main Translation-en           
Get:2 http://ftp.debian.org jessie-updates/main i386 Packages/DiffIndex [7,408 B]
Hit http://ftp.debian.org jessie-updates/contrib i386 Packages
Hit http://ftp.debian.org jessie-updates/contrib Translation-en
Get:3 http://ftp.debian.org jessie-updates/main Translation-en/DiffIndex [2,704 B]
Hit http://ftp.debian.org stable Release.gpg                 
Hit http://ftp.debian.org stable Release      
Hit http://ftp.debian.org stable/main amd64 Packages
Hit http://ftp.debian.org stable/contrib amd64 Packages
Hit http://ftp.debian.org stable/non-free amd64 Packages
Hit http://ftp.debian.org stable/main i386 Packages
Hit http://ftp.debian.org stable/contrib i386 Packages
Hit http://ftp.debian.org stable/non-free i386 Packages
Hit http://ftp.debian.org stable/contrib Translation-en
Hit http://ftp.debian.org stable/main Translation-en
Hit http://ftp.debian.org stable/non-free Translation-en
Fetched 17.5 kB in 6s (2,683 B/s)                                             
Reading package lists... Done

Then install the Git from terminal by running the command.

root@linuxhelp:~# apt-get install git
Reading package lists... Done
Building dependency tree      
Reading state information... Done
The following extra packages will be installed:
  git-man liberror-perl rsync
Suggested packages:
  git-daemon-run git-daemon-sysvinit git-doc git-el git-email git-gui gitk
  gitweb git-arch git-cvs git-mediawiki git-svn openssh-server
The following NEW packages will be installed:
  git git-man liberror-perl rsync
0 upgraded, 4 newly installed, 0 to remove and 2 not upgraded.
Need to get 4,942 kB of archives.
After this operation, 24.3 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://ftp.debian.org/debian/ stable/main liberror-perl all 0.17-1.1 [22.4 kB]
Get:2 http://ftp.debian.org/debian/ stable/main git-man all 1:2.1.4-2.1+deb8u2 [1,267 kB]
Get:3 http://ftp.debian.org/debian/ stable/main git amd64 1:2.1.4-2.1+deb8u2 [3,262 kB]
Get:4 http://ftp.debian.org/debian/ stable/main rsync amd64 3.1.1-3 [390 kB]  
Fetched 4,942 kB in 43s (115 kB/s)                                            
Selecting previously unselected package liberror-perl.
(Reading database ... 184045 files and directories currently installed.)
Preparing to unpack .../liberror-perl_0.17-1.1_all.deb ...
Unpacking liberror-perl (0.17-1.1) ...
Selecting previously unselected package git-man.
Preparing to unpack .../git-man_1%3a2.1.4-2.1+deb8u2_all.deb ...
Unpacking git-man (1:2.1.4-2.1+deb8u2) ...
Selecting previously unselected package git.
Preparing to unpack .../git_1%3a2.1.4-2.1+deb8u2_amd64.deb ...
Unpacking git (1:2.1.4-2.1+deb8u2) ...
Selecting previously unselected package rsync.
Preparing to unpack .../rsync_3.1.1-3_amd64.deb ...
Unpacking rsync (3.1.1-3) ...
Processing triggers for man-db (2.7.0.2-5) ...
Processing triggers for systemd (215-17+deb8u6) ...
Setting up liberror-perl (0.17-1.1) ...
Setting up git-man (1:2.1.4-2.1+deb8u2) ...
Setting up git (1:2.1.4-2.1+deb8u2) ...
Setting up rsync (3.1.1-3) ...
Processing triggers for systemd (215-17+deb8u6) ...

Now you can check the version of git by entering the following command.

root@linuxhelp:~# git --version
git version 2.1.4

The installation process is complete. Wasn' t that an easy installation? Git is more widely used to track the files and directories in any Linux Distribution.

Tag : Git
FAQ
Q
which command to install the Git in terminal?
A
install the Git from terminal by running the command.
# apt-get install git
Q
Which command to check the version of git?
A
you can check the version of git by entering the following command.
# git --version
Q
where to get the installation procedure for Git in ubuntu?
A
use the below link to get the installation procedure for Git
https://www.linuxhelp.com/install-git-ubuntu/
Q
How to switch between two branches in Git?
A
Use "git checkout branch name" switch between two branches
Q
How to initiate .git in terminal?
A
Initiate .git in terminal by following Command "git init"