What is Git and How to Install it on Linux and Windows OS’

Özgür Kolukısa
5 min readMay 12, 2023

--

Git logo

Git is a distributed version control system that tracks changes in any set of computer files, usually used for coordinating work among programmers collaboratively developing source code during software development². Git was originally authored by Linus Torvalds in 2005 for development of the Linux kernel, and it is now one of the most popular and widely used version control systems in the world.

Git has many advantages over other version control systems, such as speed, data integrity, and support for distributed, non-linear workflows. With Git, every developer has a full copy of the project history and can work independently without relying on a central server or network access. Git also has powerful features such as branching, merging, rebasing, stashing, and cherry-picking that allow developers to manage complex projects with ease. I will save my words about these powerful features for the future articles ;)

Git is a popular and widely used version control system, but it is not the only one. There are many other alternatives and competitors to Git that offer different features and benefits. Some of the most common ones are:

  • GitHub: GitHub is a web-based platform that hosts Git repositories and provides collaboration tools for developers. GitHub also offers additional features such as code review, project management, issue tracking, and integrations with other services.
  • SVN (Subversion): SVN is a centralized version control system that stores information as a list of file-based changes. SVN is older than Git and has a simpler workflow, but it lacks some of the advanced features of Git such as branching and merging.
  • Bitbucket: Bitbucket is another web-based platform that hosts Git repositories and provides collaboration tools for developers. Bitbucket also offers features such as code review, project management, issue tracking, and integrations with other services. Bitbucket is owned by Atlassian, the same company that makes Jira and Confluence.
  • Perforce: Perforce is an industrial-strength version control and collaboration platform that supports flexible workflows. Perforce can handle large-scale, distributed projects with high performance and security. Perforce also offers features such as code review, project management, issue tracking, and integrations with other services.
  • Mercurial: Mercurial is another distributed version control system that tracks changes in any set of computer files. Mercurial is similar to Git in many ways, but it has a different command syntax and data model. Mercurial also offers features such as code review, project management, issue tracking, and integrations with other services.

These are some of the most popular alternatives and competitors to Git, but there are many more. Because of this article is related about the git, it will continue about git of course.

In this article, we will show you how to install Git on Linux and Windows operating systems, and how to verify that it is working correctly.

Installing Git on Linux

There are different ways to install Git on Linux, depending on your distribution and package manager. Here are some common methods:

- Using apt (for Debian/Ubuntu): To install Git using apt, you need to update your system’s package index first:

sudo apt update

Then, you can install Git with this command:

sudo apt install git

- Using yum (for CentOS/RHEL/Fedora): To install Git using yum, you need to enable the EPEL (Extra Packages for Enterprise Linux) repository first:

sudo yum install epel-release

Then, you can install Git with this command:

sudo yum install git

- Using dnf (for Fedora): To install Git using dnf, you can simply run this command:

sudo dnf install git

- Using pacman (for Arch Linux): To install Git using pacman, you can simply run this command:

sudo pacman -S git

- Using zypper (for openSUSE): To install Git using zypper, you can simply run this command:

sudo zypper install git

- **Compiling from source**: If none of the above methods work for you, or if you want to install the latest version of Git from source, you can follow these steps:

- First, you need to install the dependencies for building Git:

sudo apt install make libssl-dev libghc-zlib-dev libcurl4-gnutls-dev libexpat1-dev gettext unzip # for Debian/Ubuntu
sudo yum groupinstall “Development Tools” # for CentOS/RHEL/Fedora
sudo dnf groupinstall “Development Tools” # for Fedora
sudo pacman -S base-devel openssl zlib curl expat perl # for Arch Linux
sudo zypper install make gcc zlib-devel libopenssl-devel libcurl-devel libexpat-devel perl-ExtUtils-MakeMaker # for openSUSE

- After that , you need to download the source code of Git from its official website by using:

wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.40.0.tar.gz # replace 2.40.0 with the latest version number

- Next, you need to extract the source code and change into the directory:

tar -xzf git-2.40.0.tar.gz # replace 2.40.0 with the latest version number
cd git-2.40.0 # replace 2.40.0 with the latest version number

- Finally, you need to configure, compile and install Git:

./configure — prefix=/usr/local # you can change the prefix to any directory you want
make
sudo make install

Installing Git on Windows

There are different ways to install Git on Windows, depending on your preference and needs. Here are some common methods:

- Using Git for Window Installers: This is the official way to install Git on Windows. It provides a bash emulation environment that allows you to use Git from the command line, as well as a graphical user interface called Git GUI that allows you to perform common Git operations with a mouse. It also comes with other useful tools such as Git Bash, Git Credential Manager, and MinTTY.

To install Git for Windows, you need to download the installer from its official website:

https://gitforwindows.org/

Then, you need to run the installer and follow the instructions on the screen. You can choose the components and options that suit your needs.

- Using Chocolatey: Chocolatey is a popular package manager for Windows that allows you to install software with a single command. To use Chocolatey, you need to have PowerShell installed and run it as an administrator.

To install Chocolatey, you need to run this command in PowerShell:

Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString(‘https://chocolatey.org/install.ps1'))

Then, to install Git using Chocolatey, you need to run this command in PowerShell:

choco install git

- Using Scoop: Scoop is another package manager for Windows that allows you to install software with a single command. To use Scoop, you need to have PowerShell installed and run it as an administrator.

To install Scoop, you need to run this command in PowerShell:

Set-ExecutionPolicy RemoteSigned -scope CurrentUser; iwr -useb get.scoop.sh | iex;

Then, to install Git using Scoop, you need to run this command in PowerShell:

scoop install git

Verifying the Installation

To verify that Git is installed correctly on your system, you can run this command in your terminal or command prompt:

git — version

This should display the version number of Git that you have installed. For example:

git version 2.40.0 # replace 2.40.0 with your actual version number

or for windows

git version 2.37.3.windows.1

or similar thing :)

Outcome

In this article, we have learned what is Git and how to install it on Linux and Windows operating systems. We have also learned how to verify that it is working correctly.

Git is a powerful and versatile tool that can help you manage your projects efficiently and collaboratively. If you want to learn more about how to use Git effectively, check out our other articles on Atlassian’s website⁴. Happy coding! 👩👨‍💻

--

--

Özgür Kolukısa
Özgür Kolukısa

Written by Özgür Kolukısa

Infrastructure Engineer, DevOps engineer

No responses yet