Install Git on any operating system

Internship at OpenGenus

Get FREE domain for 1st year and build your brand new site

Reading time: 15 minutes | Installation time: 2 minutes

The first step towards getting started with Git is to install it on your local machine. The process is simple and takes a few minutes and the commands to do so vary for various operating system. We have covered the commands to install git for the following operating systems:

  • Ubuntu
  • RHEL
  • Windows
  • MacOS
  • Fedora

Install Git on Ubuntu

sudo apt-get update
sudo apt-get install git-core
git --version

Install Git on RHEL

sudo yum update
sudo yum install git 
git --version

Install Git on OpenSUSE / SLES / SLED

zypper in git-core
git --version

Install Git on Windows

Go to and the download will start automatically. Double click on the downloaded file and follow the installation instructions.

Install Git on MacOS

Install XCode and type the following command:

git --version

If git is not installed, it will prompt to install it and follow the installation steps.

Install Git on Fedora

dnf -y update
dnf -y install git
git --version


Once you have installed Git on your machine, you need to configure it.

git config --global "your_username"
git config --global ""
git config --list