Install Git on Windows 10 and Ubuntu 20.04

By CodersDrive
22-Jul-2020
git

Git is a distributed version control system used by software developers for tracking changes and also for proper coordinating work among programmers while developing an application. Git has the capability to track changes at each file level. Git is one of the popular and widely used version control tool, git can be used freely for individual purpose by registering, it supports both private and public repositories. Git also has pro version for bigger companies and for larger teams usage.

Install Git on Windows

The best way to install Git for windows is to download it from https://git-scm.com/download/win, by clicking this the .exe file will be downloaded. This is a Git project for windows not an official Git project, but they will maintain the most recent official build available to download.

Install git on windows 10

Just install this like every windows exe file. After successful installation two components Git BASH and Git GUI will be installed. Git BASH will provide git usage from windows CMD or PowerShell. Git GUI will provide a graphical user interface for users who prefer this.

If once done, verify the installed version using the following command.

git --version

Before use of this one should configure your name and email once as per the below commands.

git config --global user.name "USERNAME"
git config --global user.email "EMAIL"

You can view the configuration changes using the following command.

git config --list
Output:
user.name=USERNAME
user.email=EMAIL

Now you can start using git.

Install Git on Ubuntu 20.04
Install Git from default local repositories

Ubuntu 20.04 contains a stable version of Git in its default repositories itself. Though newer versions may be avaialable from original source repositories, the one installed from Ubuntu repositories will be stable with current version of Ubuntu.

Installation is pretty simple, enter the following commands on your terminal.

sudo apt update
sudo apt install git

First command will refresh your local package index and the second command will install git on your system. After successful installation verify the installation version using the below command.

git --version

This will print the installed git version, if nothing has appeared or any error occurred means the application was not properly installed.

Install Git from original source

In some scenarios where you need to install the latest git release whcih is not currently available under default reposoitories, can be installed from original Git source. Before that lets do some pre-requisite installation using the following commands.

sudo apt update
sudo apt install dh-autoreconf libcurl4-gnutls-dev libexpat1-dev make gettext libz-dev libssl-dev libghc-zlib-dev

Once the installation of pre-requisite are done, visit Git project's Mirror Git Hub and then copy the required version link that ends with tar.gz as shown in below screenshot.

Install latest version git from git source

Now we will download the required version using wget and extract it to /usr/src directory using the following command.

wget -c https://github.com/git/git/archive/v2.28.0-rc1.tar.gz -O - | sudo tar -xz -C /usr/src

Paste the above copied link in place of https://github.com/git/git/archive/v2.28.0-rc1.tar.gz for your required version. This command will download the package and extract it to /usr/src/.

Now we will install this using the following commands in order.

cd /usr/src/git-*
sudo make prefix=/usr/local all
sudo make prefix=/usr/local install

This will take some time to install. Once the process is finsihed check the version using the below command.

git --version

This will print the installed git version, if nothing has appeared or any error occurred means the application was not properly installed.

Configuring Git

Before use of this, one should configure your name and email once as per the below commands.

git config --global user.name "USERNAME"
git config --global user.email "EMAIL"

You can view the configuration changes using the following command.

git config --list
Output:
user.name=USERNAME
user.email=EMAIL

git Ubuntu Windows

Search blog..!

Connect with us