How to Install Git on CentOS, Ubuntu and Windows?

How to Install Git on CentOS, Ubuntu and Windows?

Git is one of the most popular open-source, distributed version control systems available, designed to handle everything from small to huge projects with speed and efficiency.

It allows you to keep track of your code changes, create different code branches, collaborate with other developers, to name a few. Linux Kernel, one of the popular open-source projects, is also hosted on a Git repository.

In this article, we’ll cover installing Git on CentOS, Ubuntu, and Windows operating systems.

Git on CentOS 6.x/7.x

To install Git on CentOS release 6.x/7.x or RHEL 6.x/7.x, we’ll use yum package manager. Run the below command to install Git:

$ sudo yum install git

If prompted to confirm like below, confirm by pressing ‘y’:

Is this ok [y/d/N]: y

Below is the installation snippet of Git on CentOS 7 minimal setup (please note dependencies installed along with Git may differ on your installation based on your OS version and installed packages):

$ sudo yum install git Loaded plugins: fastestmirror Determining fastest mirrors * base: centos.excellmedia.net * extras: centos.excellmedia.net * updates: centos.excellmedia.net base | 3.6 kB 00:00:00 docker-ce-stable | 3.5 kB 00:00:00 extras | 2.9 kB 00:00:00 updates | 2.9 kB 00:00:00 (1/2): docker-ce-stable/7/x86_64/primary_db | 50 kB 00:00:00 (2/2): updates/7/x86_64/primary_db | 3.7 MB 00:00:00 Resolving Dependencies --> Running transaction check ---> Package git.x86_64 0:1.8.3.1-23.el7_8 will be installed --> Processing Dependency: perl-Git = 1.8.3.1-23.el7_8 for package: git-1.8.3.1-23.el7_8.x86_64 --> Processing Dependency: perl >= 5.008 for package: git-1.8.3.1-23.el7_8.x86_64 --> Processing Dependency: rsync for package: git-1.8.3.1-23.el7_8.x86_64 --> Processing Dependency: perl(warnings) for package: git-1.8.3.1-23.el7_8.x86_64 --> Processing Dependency: perl(vars) for package: git-1.8.3.1-23.el7_8.x86_64 --> Processing Dependency: perl(strict) for package: git-1.8.3.1-23.el7_8.x86_64 --> Processing Dependency: perl(lib) for package: git-1.8.3.1-23.el7_8.x86_64 --> Processing Dependency: perl(Term::ReadKey) for package: git-1.8.3.1-23.el7_8.x86_64 --> Processing Dependency: perl(Git) for package: git-1.8.3.1-23.el7_8.x86_64 --> Processing Dependency: perl(Getopt::Long) for package: git-1.8.3.1-23.el7_8.x86_64 --> Processing Dependency: perl(File::stat) for package: git-1.8.3.1-23.el7_8.x86_64 --> Processing Dependency: perl(File::Temp) for package: git-1.8.3.1-23.el7_8.x86_64 --> Processing Dependency: perl(File::Spec) for package: git-1.8.3.1-23.el7_8.x86_64 --> Processing Dependency: perl(File::Path) for package: git-1.8.3.1-23.el7_8.x86_64 --> Processing Dependency: perl(File::Find) for package: git-1.8.3.1-23.el7_8.x86_64 --> Processing Dependency: perl(File::Copy) for package: git-1.8.3.1-23.el7_8.x86_64 --> Processing Dependency: perl(File::Basename) for package: git-1.8.3.1-23.el7_8.x86_64 --> Processing Dependency: perl(Exporter) for package: git-1.8.3.1-23.el7_8.x86_64 --> Processing Dependency: perl(Error) for package: git-1.8.3.1-23.el7_8.x86_64 --> Processing Dependency: /usr/bin/perl for package: git-1.8.3.1-23.el7_8.x86_64 --> Running transaction check ---> Package perl.x86_64 4:5.16.3-297.el7 will be installed --> Processing Dependency: perl-libs = 4:5.16.3-297.el7 for package: 4:perl-5.16.3-297.el7.x86_64 --> Processing Dependency: perl(Socket) >= 1.3 for package: 4:perl-5.16.3-297.el7.x86_64 --> Processing Dependency: perl(Scalar::Util) >= 1.10 for package: 4:perl-5.16.3-297.el7.x86_64 --> Processing Dependency: perl-macros for package: 4:perl-5.16.3-297.el7.x86_64 --> Processing Dependency: perl-libs for package: 4:perl-5.16.3-297.el7.x86_64 --> Processing Dependency: perl(threads::shared) for package: 4:perl-5.16.3-297.el7.x86_64 --> Processing Dependency: perl(threads) for package: 4:perl-5.16.3-297.el7.x86_64 --> Processing Dependency: perl(constant) for package: 4:perl-5.16.3-297.el7.x86_64 --> Processing Dependency: perl(Time::Local) for package: 4:perl-5.16.3-297.el7.x86_64 --> Processing Dependency: perl(Time::HiRes) for package: 4:perl-5.16.3-297.el7.x86_64 --> Processing Dependency: perl(Storable) for package: 4:perl-5.16.3-297.el7.x86_64 --> Processing Dependency: perl(Socket) for package: 4:perl-5.16.3-297.el7.x86_64 --> Processing Dependency: perl(Scalar::Util) for package: 4:perl-5.16.3-297.el7.x86_64 --> Processing Dependency: perl(Pod::Simple::XHTML) for package: 4:perl-5.16.3-297.el7.x86_64 --> Processing Dependency: perl(Pod::Simple::Search) for package: 4:perl-5.16.3-297.el7.x86_64 --> Processing Dependency: perl(Filter::Util::Call) for package: 4:perl-5.16.3-297.el7.x86_64 --> Processing Dependency: perl(Carp) for package: 4:perl-5.16.3-297.el7.x86_64 --> Processing Dependency: libperl.so()(64bit) for package: 4:perl-5.16.3-297.el7.x86_64 ---> Package perl-Error.noarch 1:0.17020-2.el7 will be installed ---> Package perl-Exporter.noarch 0:5.68-3.el7 will be installed ---> Package perl-File-Path.noarch 0:2.09-2.el7 will be installed ---> Package perl-File-Temp.noarch 0:0.23.01-3.el7 will be installed ---> Package perl-Getopt-Long.noarch 0:2.40-3.el7 will be installed --> Processing Dependency: perl(Pod::Usage) >= 1.14 for package: perl-Getopt-Long-2.40-3.el7.noarch --> Processing Dependency: perl(Text::ParseWords) for package: perl-Getopt-Long-2.40-3.el7.noarch ---> Package perl-Git.noarch 0:1.8.3.1-23.el7_8 will be installed ---> Package perl-PathTools.x86_64 0:3.40-5.el7 will be installed ---> Package perl-TermReadKey.x86_64 0:2.30-20.el7 will be installed ---> Package rsync.x86_64 0:3.1.2-10.el7 will be installed --> Running transaction check ---> Package perl-Carp.noarch 0:1.26-244.el7 will be installed ---> Package perl-Filter.x86_64 0:1.49-3.el7 will be installed ---> Package perl-Pod-Simple.noarch 1:3.28-4.el7 will be installed --> Processing Dependency: perl(Pod::Escapes) >= 1.04 for package: 1:perl-Pod-Simple-3.28-4.el7.noarch --> Processing Dependency: perl(Encode) for package: 1:perl-Pod-Simple-3.28-4.el7.noarch ---> Package perl-Pod-Usage.noarch 0:1.63-3.el7 will be installed --> Processing Dependency: perl(Pod::Text) >= 3.15 for package: perl-Pod-Usage-1.63-3.el7.noarch --> Processing Dependency: perl-Pod-Perldoc for package: perl-Pod-Usage-1.63-3.el7.noarch ---> Package perl-Scalar-List-Utils.x86_64 0:1.27-248.el7 will be installed ---> Package perl-Socket.x86_64 0:2.010-5.el7 will be installed ---> Package perl-Storable.x86_64 0:2.45-3.el7 will be installed ---> Package perl-Text-ParseWords.noarch 0:3.29-4.el7 will be installed ---> Package perl-Time-HiRes.x86_64 4:1.9725-3.el7 will be installed ---> Package perl-Time-Local.noarch 0:1.2300-2.el7 will be installed ---> Package perl-constant.noarch 0:1.27-2.el7 will be installed ---> Package perl-libs.x86_64 4:5.16.3-297.el7 will be installed ---> Package perl-macros.x86_64 4:5.16.3-297.el7 will be installed ---> Package perl-threads.x86_64 0:1.87-4.el7 will be installed ---> Package perl-threads-shared.x86_64 0:1.43-6.el7 will be installed --> Running transaction check ---> Package perl-Encode.x86_64 0:2.51-7.el7 will be installed ---> Package perl-Pod-Escapes.noarch 1:1.04-297.el7 will be installed ---> Package perl-Pod-Perldoc.noarch 0:3.20-4.el7 will be installed --> Processing Dependency: perl(parent) for package: perl-Pod-Perldoc-3.20-4.el7.noarch --> Processing Dependency: perl(HTTP::Tiny) for package: perl-Pod-Perldoc-3.20-4.el7.noarch ---> Package perl-podlators.noarch 0:2.5.1-3.el7 will be installed --> Running transaction check ---> Package perl-HTTP-Tiny.noarch 0:0.033-3.el7 will be installed ---> Package perl-parent.noarch 1:0.225-244.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ========================================================================================================================================================================== Package Arch Version Repository Size ========================================================================================================================================================================== Installing: git x86_64 1.8.3.1-23.el7_8 base 4.4 M Installing for dependencies: perl x86_64 4:5.16.3-297.el7 base 8.0 M perl-Carp noarch 1.26-244.el7 base 19 k perl-Encode x86_64 2.51-7.el7 base 1.5 M perl-Error noarch 1:0.17020-2.el7 base 32 k perl-Exporter noarch 5.68-3.el7 base 28 k perl-File-Path noarch 2.09-2.el7 base 26 k perl-File-Temp noarch 0.23.01-3.el7 base 56 k perl-Filter x86_64 1.49-3.el7 base 76 k perl-Getopt-Long noarch 2.40-3.el7 base 56 k perl-Git noarch 1.8.3.1-23.el7_8 base 56 k perl-HTTP-Tiny noarch 0.033-3.el7 base 38 k perl-PathTools x86_64 3.40-5.el7 base 82 k perl-Pod-Escapes noarch 1:1.04-297.el7 base 52 k perl-Pod-Perldoc noarch 3.20-4.el7 base 87 k perl-Pod-Simple noarch 1:3.28-4.el7 base 216 k perl-Pod-Usage noarch 1.63-3.el7 base 27 k perl-Scalar-List-Utils x86_64 1.27-248.el7 base 36 k perl-Socket x86_64 2.010-5.el7 base 49 k perl-Storable x86_64 2.45-3.el7 base 77 k perl-TermReadKey x86_64 2.30-20.el7 base 31 k perl-Text-ParseWords noarch 3.29-4.el7 base 14 k perl-Time-HiRes x86_64 4:1.9725-3.el7 base 45 k perl-Time-Local noarch 1.2300-2.el7 base 24 k perl-constant noarch 1.27-2.el7 base 19 k perl-libs x86_64 4:5.16.3-297.el7 base 689 k perl-macros x86_64 4:5.16.3-297.el7 base 44 k perl-parent noarch 1:0.225-244.el7 base 12 k perl-podlators noarch 2.5.1-3.el7 base 112 k perl-threads x86_64 1.87-4.el7 base 49 k perl-threads-shared x86_64 1.43-6.el7 base 39 k rsync x86_64 3.1.2-10.el7 base 404 k Transaction Summary ========================================================================================================================================================================== Install 1 Package (+31 Dependent packages) Total download size: 16 M Installed size: 59 M Is this ok [y/d/N]: y Downloading packages: (1/32): git-1.8.3.1-23.el7_8.x86_64.rpm | 4.4 MB 00:00:01 (2/32): perl-Carp-1.26-244.el7.noarch.rpm | 19 kB 00:00:00 (3/32): perl-Encode-2.51-7.el7.x86_64.rpm | 1.5 MB 00:00:00 (4/32): perl-Error-0.17020-2.el7.noarch.rpm | 32 kB 00:00:00 (5/32): perl-Exporter-5.68-3.el7.noarch.rpm | 28 kB 00:00:00 (6/32): perl-File-Path-2.09-2.el7.noarch.rpm | 26 kB 00:00:00 (7/32): perl-File-Temp-0.23.01-3.el7.noarch.rpm | 56 kB 00:00:00 (8/32): perl-Filter-1.49-3.el7.x86_64.rpm | 76 kB 00:00:00 (9/32): perl-Getopt-Long-2.40-3.el7.noarch.rpm | 56 kB 00:00:00 (10/32): perl-Git-1.8.3.1-23.el7_8.noarch.rpm | 56 kB 00:00:00 (11/32): perl-HTTP-Tiny-0.033-3.el7.noarch.rpm | 38 kB 00:00:00 (12/32): perl-PathTools-3.40-5.el7.x86_64.rpm | 82 kB 00:00:00 (13/32): perl-Pod-Escapes-1.04-297.el7.noarch.rpm | 52 kB 00:00:00 (14/32): perl-Pod-Perldoc-3.20-4.el7.noarch.rpm | 87 kB 00:00:00 (15/32): perl-5.16.3-297.el7.x86_64.rpm | 8.0 MB 00:00:02 (16/32): perl-Pod-Simple-3.28-4.el7.noarch.rpm | 216 kB 00:00:00 (17/32): perl-Pod-Usage-1.63-3.el7.noarch.rpm | 27 kB 00:00:00 (18/32): perl-Scalar-List-Utils-1.27-248.el7.x86_64.rpm | 36 kB 00:00:00 (19/32): perl-Socket-2.010-5.el7.x86_64.rpm | 49 kB 00:00:00 (20/32): perl-Storable-2.45-3.el7.x86_64.rpm | 77 kB 00:00:00 (21/32): perl-TermReadKey-2.30-20.el7.x86_64.rpm | 31 kB 00:00:00 (22/32): perl-Text-ParseWords-3.29-4.el7.noarch.rpm | 14 kB 00:00:00 (23/32): perl-Time-HiRes-1.9725-3.el7.x86_64.rpm | 45 kB 00:00:00 (24/32): perl-Time-Local-1.2300-2.el7.noarch.rpm | 24 kB 00:00:00 (25/32): perl-constant-1.27-2.el7.noarch.rpm | 19 kB 00:00:00 (26/32): perl-libs-5.16.3-297.el7.x86_64.rpm | 689 kB 00:00:00 (27/32): perl-macros-5.16.3-297.el7.x86_64.rpm | 44 kB 00:00:00 (28/32): perl-parent-0.225-244.el7.noarch.rpm | 12 kB 00:00:00 (29/32): perl-podlators-2.5.1-3.el7.noarch.rpm | 112 kB 00:00:00 (30/32): perl-threads-1.87-4.el7.x86_64.rpm | 49 kB 00:00:00 (31/32): perl-threads-shared-1.43-6.el7.x86_64.rpm | 39 kB 00:00:00 (32/32): rsync-3.1.2-10.el7.x86_64.rpm | 404 kB 00:00:00 -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Total 5.0 MB/s | 16 MB 00:00:03 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : 1:perl-parent-0.225-244.el7.noarch 1/32 Installing : perl-HTTP-Tiny-0.033-3.el7.noarch 2/32 Installing : perl-podlators-2.5.1-3.el7.noarch 3/32 Installing : perl-Pod-Perldoc-3.20-4.el7.noarch 4/32 Installing : 1:perl-Pod-Escapes-1.04-297.el7.noarch 5/32 Installing : perl-Encode-2.51-7.el7.x86_64 6/32 Installing : perl-Text-ParseWords-3.29-4.el7.noarch 7/32 Installing : perl-Pod-Usage-1.63-3.el7.noarch 8/32 Installing : 4:perl-libs-5.16.3-297.el7.x86_64 9/32 Installing : perl-Storable-2.45-3.el7.x86_64 10/32 Installing : perl-Exporter-5.68-3.el7.noarch 11/32 Installing : perl-constant-1.27-2.el7.noarch 12/32 Installing : perl-Socket-2.010-5.el7.x86_64 13/32 Installing : perl-Time-Local-1.2300-2.el7.noarch 14/32 Installing : perl-Carp-1.26-244.el7.noarch 15/32 Installing : 4:perl-Time-HiRes-1.9725-3.el7.x86_64 16/32 Installing : perl-PathTools-3.40-5.el7.x86_64 17/32 Installing : perl-Scalar-List-Utils-1.27-248.el7.x86_64 18/32 Installing : 1:perl-Pod-Simple-3.28-4.el7.noarch 19/32 Installing : perl-File-Temp-0.23.01-3.el7.noarch 20/32 Installing : perl-File-Path-2.09-2.el7.noarch 21/32 Installing : perl-threads-shared-1.43-6.el7.x86_64 22/32 Installing : perl-threads-1.87-4.el7.x86_64 23/32 Installing : perl-Filter-1.49-3.el7.x86_64 24/32 Installing : 4:perl-macros-5.16.3-297.el7.x86_64 25/32 Installing : perl-Getopt-Long-2.40-3.el7.noarch 26/32 Installing : 4:perl-5.16.3-297.el7.x86_64 27/32 Installing : 1:perl-Error-0.17020-2.el7.noarch 28/32 Installing : perl-TermReadKey-2.30-20.el7.x86_64 29/32 Installing : rsync-3.1.2-10.el7.x86_64 30/32 Installing : perl-Git-1.8.3.1-23.el7_8.noarch 31/32 Installing : git-1.8.3.1-23.el7_8.x86_64 32/32 Verifying : perl-HTTP-Tiny-0.033-3.el7.noarch 1/32 Verifying : perl-threads-shared-1.43-6.el7.x86_64 2/32 Verifying : perl-Storable-2.45-3.el7.x86_64 3/32 Verifying : 4:perl-libs-5.16.3-297.el7.x86_64 4/32 Verifying : perl-Exporter-5.68-3.el7.noarch 5/32 Verifying : perl-constant-1.27-2.el7.noarch 6/32 Verifying : perl-PathTools-3.40-5.el7.x86_64 7/32 Verifying : perl-Socket-2.010-5.el7.x86_64 8/32 Verifying : git-1.8.3.1-23.el7_8.x86_64 9/32 Verifying : 1:perl-parent-0.225-244.el7.noarch 10/32 Verifying : perl-TermReadKey-2.30-20.el7.x86_64 11/32 Verifying : 1:perl-Pod-Escapes-1.04-297.el7.noarch 12/32 Verifying : perl-File-Temp-0.23.01-3.el7.noarch 13/32 Verifying : 1:perl-Pod-Simple-3.28-4.el7.noarch 14/32 Verifying : perl-Time-Local-1.2300-2.el7.noarch 15/32 Verifying : perl-Git-1.8.3.1-23.el7_8.noarch 16/32 Verifying : perl-Carp-1.26-244.el7.noarch 17/32 Verifying : 1:perl-Error-0.17020-2.el7.noarch 18/32 Verifying : 4:perl-Time-HiRes-1.9725-3.el7.x86_64 19/32 Verifying : perl-Scalar-List-Utils-1.27-248.el7.x86_64 20/32 Verifying : perl-Pod-Usage-1.63-3.el7.noarch 21/32 Verifying : perl-Encode-2.51-7.el7.x86_64 22/32 Verifying : perl-Pod-Perldoc-3.20-4.el7.noarch 23/32 Verifying : perl-podlators-2.5.1-3.el7.noarch 24/32 Verifying : perl-File-Path-2.09-2.el7.noarch 25/32 Verifying : perl-threads-1.87-4.el7.x86_64 26/32 Verifying : rsync-3.1.2-10.el7.x86_64 27/32 Verifying : perl-Filter-1.49-3.el7.x86_64 28/32 Verifying : perl-Getopt-Long-2.40-3.el7.noarch 29/32 Verifying : perl-Text-ParseWords-3.29-4.el7.noarch 30/32 Verifying : 4:perl-5.16.3-297.el7.x86_64 31/32 Verifying : 4:perl-macros-5.16.3-297.el7.x86_64 32/32 Installed: git.x86_64 0:1.8.3.1-23.el7_8 Dependency Installed: perl.x86_64 4:5.16.3-297.el7 perl-Carp.noarch 0:1.26-244.el7 perl-Encode.x86_64 0:2.51-7.el7 perl-Error.noarch 1:0.17020-2.el7 perl-Exporter.noarch 0:5.68-3.el7 perl-File-Path.noarch 0:2.09-2.el7 perl-File-Temp.noarch 0:0.23.01-3.el7 perl-Filter.x86_64 0:1.49-3.el7 perl-Getopt-Long.noarch 0:2.40-3.el7 perl-Git.noarch 0:1.8.3.1-23.el7_8 perl-HTTP-Tiny.noarch 0:0.033-3.el7 perl-PathTools.x86_64 0:3.40-5.el7 perl-Pod-Escapes.noarch 1:1.04-297.el7 perl-Pod-Perldoc.noarch 0:3.20-4.el7 perl-Pod-Simple.noarch 1:3.28-4.el7 perl-Pod-Usage.noarch 0:1.63-3.el7 perl-Scalar-List-Utils.x86_64 0:1.27-248.el7 perl-Socket.x86_64 0:2.010-5.el7 perl-Storable.x86_64 0:2.45-3.el7 perl-TermReadKey.x86_64 0:2.30-20.el7 perl-Text-ParseWords.noarch 0:3.29-4.el7 perl-Time-HiRes.x86_64 4:1.9725-3.el7 perl-Time-Local.noarch 0:1.2300-2.el7 perl-constant.noarch 0:1.27-2.el7 perl-libs.x86_64 4:5.16.3-297.el7 perl-macros.x86_64 4:5.16.3-297.el7 perl-parent.noarch 1:0.225-244.el7 perl-podlators.noarch 0:2.5.1-3.el7 perl-threads.x86_64 0:1.87-4.el7 perl-threads-shared.x86_64 0:1.43-6.el7 rsync.x86_64 0:3.1.2-10.el7 Complete! $

Git on CentOS 8.x

To install Git on CentOS release 8.x or RHEL 8.x, we’ll use DNF package manager. Run the below command to install Git:

$ sudo dnf install git

If prompted to confirm, press ‘y’:

Is this ok [y/N]: y

Here’s the installation snippet of installing Git on CentOS 8:

$ sudo dnf install git CentOS-8 - AppStream 9.1 kB/s | 4.3 kB 00:00 CentOS-8 - AppStream 752 kB/s | 6.2 MB 00:08 CentOS-8 - Base 6.5 kB/s | 3.9 kB 00:00 CentOS-8 - Base 1.6 MB/s | 2.3 MB 00:01 CentOS-8 - Extras 3.5 kB/s | 1.5 kB 00:00 CentOS-8 - Extras 12 kB/s | 8.1 kB 00:00 Extra Packages for Enterprise Linux Modular 8 - x86_64 15 kB/s | 8.5 kB 00:00 Extra Packages for Enterprise Linux 8 - x86_64 10 kB/s | 9.1 kB 00:00 Extra Packages for Enterprise Linux 8 - x86_64 2.4 MB/s | 8.6 MB 00:03 Dependencies resolved. ========================================================================================================================================================================== Package Architecture Version Repository Size ========================================================================================================================================================================== Installing: git x86_64 2.27.0-1.el8 AppStream 164 k Installing dependencies: git-core x86_64 2.27.0-1.el8 AppStream 5.7 M git-core-doc noarch 2.27.0-1.el8 AppStream 2.5 M perl-Error noarch 1:0.17025-2.el8 AppStream 46 k perl-Git noarch 2.27.0-1.el8 AppStream 77 k Transaction Summary ========================================================================================================================================================================== Install 5 Packages Total download size: 8.5 M Installed size: 45 M Is this ok [y/N]: y Downloading Packages: (1/5): git-2.27.0-1.el8.x86_64.rpm 299 kB/s | 164 kB 00:00 (2/5): perl-Error-0.17025-2.el8.noarch.rpm 173 kB/s | 46 kB 00:00 (3/5): perl-Git-2.27.0-1.el8.noarch.rpm 182 kB/s | 77 kB 00:00 (4/5): git-core-doc-2.27.0-1.el8.noarch.rpm 813 kB/s | 2.5 MB 00:03 (5/5): git-core-2.27.0-1.el8.x86_64.rpm 431 kB/s | 5.7 MB 00:13 -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Total 615 kB/s | 8.5 MB 00:14 Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Installing : git-core-2.27.0-1.el8.x86_64 1/5 Installing : git-core-doc-2.27.0-1.el8.noarch 2/5 Installing : perl-Error-1:0.17025-2.el8.noarch 3/5 Installing : perl-Git-2.27.0-1.el8.noarch 4/5 Installing : git-2.27.0-1.el8.x86_64 5/5 Running scriptlet: git-2.27.0-1.el8.x86_64 5/5 Verifying : git-2.27.0-1.el8.x86_64 1/5 Verifying : git-core-2.27.0-1.el8.x86_64 2/5 Verifying : git-core-doc-2.27.0-1.el8.noarch 3/5 Verifying : perl-Error-1:0.17025-2.el8.noarch 4/5 Verifying : perl-Git-2.27.0-1.el8.noarch 5/5 Installed products updated. Installed: git-2.27.0-1.el8.x86_64 git-core-2.27.0-1.el8.x86_64 git-core-doc-2.27.0-1.el8.noarch perl-Error-1:0.17025-2.el8.noarch perl-Git-2.27.0-1.el8.noarch Complete! $

Git on Ubuntu

On Ubuntu, the simplest way to install git is to use an apt package manager. First, update the apt package index by using the below command:

$ sudo apt update
$ sudo apt update Hit:1 http://in.archive.ubuntu.com/ubuntu groovy InRelease Hit:2 http://in.archive.ubuntu.com/ubuntu groovy-updates InRelease Hit:3 http://in.archive.ubuntu.com/ubuntu groovy-backports InRelease Get:4 http://security.ubuntu.com/ubuntu groovy-security InRelease [110 kB] Fetched 110 kB in 1s (110 kB/s) Reading package lists... Done Building dependency tree Reading state information... Done All packages are up to date. $

Now, run the below command to install Git on Ubuntu:

$ sudo apt install git

If prompted to confirm, press ‘Y’:

Do you want to continue? [Y/n] Y

Below is an installation log snippet for installation on Ubuntu 20:

$ sudo apt install git Reading package lists... Done Building dependency tree Reading state information... Done 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 0 not upgraded. Need to get 5,764 kB of archives. After this operation, 41.2 MB of additional disk space will be used. Do you want to continue? [Y/n] Y Get:1 http://in.archive.ubuntu.com/ubuntu groovy/main amd64 liberror-perl all 0.17029-1 [26.5 kB] Get:2 http://in.archive.ubuntu.com/ubuntu groovy/main amd64 git-man all 1:2.27.0-1ubuntu1 [911 kB] Get:3 http://in.archive.ubuntu.com/ubuntu groovy/main amd64 git amd64 1:2.27.0-1ubuntu1 [4,827 kB] Fetched 5,764 kB in 1s (9,187 kB/s) Selecting previously unselected package liberror-perl. (Reading database ... 292528 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.27.0-1ubuntu1_all.deb ... Unpacking git-man (1:2.27.0-1ubuntu1) ... Selecting previously unselected package git. Preparing to unpack .../git_1%3a2.27.0-1ubuntu1_amd64.deb ... Unpacking git (1:2.27.0-1ubuntu1) ... Setting up liberror-perl (0.17029-1) ... Setting up git-man (1:2.27.0-1ubuntu1) ... Setting up git (1:2.27.0-1ubuntu1) ... Processing triggers for man-db (2.9.3-2) ... $

Git on Windows

Windows binary installers are available from the official Git site. Download the applicable installer to your Windows system.

As of version 2.29.2, it offers 32 bit and 64-bit versions of Git; choose the one that matches your needs and system architecture. Most new systems support 64-bit architecture, and the default downloader provided by the site should be good for most purposes.

  • Launch the downloaded Git installer, and the installation wizard should pop-up. Accept any prompts that Windows’ User Access Control may show at the beginning of the installation. The installer will request Administrative access and should be accepted for the installation to succeed.
  • A portable version of Git is also available, which can be used as an alternative if the installation isn’t possible using normal means due to administrative restrictions. Accept the License agreement and click on Next.

Git Installation on Windows

  • Specify the installation path for Git or leave the default one shown in the dialog. Click Next to continue.

Git Installation on Windows

  • Select Components dialog allows you to select Git components that should be available post-installation. Default options should be good for most purposes. Click Next once required components are selected.

Git Installation on Windows

  • Start Menu shortcut option is shown next. Click Next to continue.

Git Installation on Windows

  • The next dialog allows you to select the default editor that will be used by Git. Vim, which is the popular Linux CLI editor, is supported and is selected by default. You’ve got the option to select a different editor like Notepad++ etc., in the drop-down list if you prefer. Click Next once confirmed.

Git Installation on Windows

  • For most cases, an initial branch naming option can be left as it is. Click Next to continue.

Git Installation on Windows

  • Git will be added to the Windows PATH variable to be accessible from other programs like Command Prompt etc. Select option 1 if you want to use Git only from Git Bash only, installed as part of Git installation. Then proceed by clicking Next.

Git Installation on Windows

  • Secure Shell or SSH executable is needed for network-related actions for Git like push and pull requests. The default option of OpenSSH provided with the installer should be good for most cases and, as such, can be left as it is. Click Next to proceed.

Git Installation on Windows

  • The default option can be selected for the OpenSSL library. This is a choice between the SSL library provided by Git and the one that comes with Windows. Click Next to continue.

Git Installation on Windows

  • Commit style needed to be confirmed, and Windows and Linux/Unix systems interpret end-of-line differently. To make the code compatible between different development platforms, Git must know how the code file has an end-of-line character specified and if this needs to be switched to another style. Again, the default option is good here, and all the switching and conversion happens in the background by Git. In case another setting is required, consult your Git code administrator. Then click Next to proceed.

Git Installation on Windows

  • Terminal emulator allows you to have either a BASH-like environment or Windows Command Prompt as the default console. Both options work well and depend upon user need requirements. Click Next to continue.

Git Installation on Windows

  • The next option is to specify the default “git pull” behavior. A default option should be selected unless you’re sure you need to change it to one of the non-default ones. Click Next to continue.

Git Installation on Windows

  • Credential Manager stores your secrets like passwords and keys that you use to login to different remote Git repositories. The first option should be good as Git Credential Manager has been deprecated. Click Next to proceed.

Git Installation on Windows

  • The next dialog allows you to select some extra options like file system caching and symbolic links. Click Next, once you select the required options.

Git Installation on Windows

  • Experimental options allow you to enable features that aren’t fully developed and tested yet. You can leave them unchecked unless you’re sure you need those. Click Install to proceed with the installation of Git with the selected options.

Git Installation on Windows

  • Git installation will start, and progress will be shown. Please wait for it to complete.

Git Installation on Windows

  • A final dialog allows you to launch Git Bash:

Git Installation on Windows

  • You’ll be able to launch Git Bash or Git GUI using Windows Start Menu. Git Bash is the similar command line CLI that Linux offers and supports all Git commands. You can verify the Git version as shown in the screenshot below:

Git Installation on Windows

Verifying Git

To verify your Git installation and check its version, use the below command in the Linux terminal (or Git Bash in Windows):

$ git --version git version 2.27.0 $ 

Further Reading

You can learn more about Git here or take this definite course.

Next, get familiar with GitOps.

NEWEST POSTS

Our trusted sources

We only publish news from well-known cybercrime magazines via RSS. You will find here everything about hackers & cybercrime. Also you can visit the direct sources from us.

Just click on one of the buttons.

PROTECT YOURSELF

Check out our Guidebook page.  And read everything about it.  Also how to protect yourself from hacker attacks.  An all in one thing.