Git is a powerful version control system that allows you to track changes in your code and collaborate effectively with others. In this guide, I will walk through the steps on How to install Git on different operating systems: Linux(Rocky Linux, RHEL, CentOS, Debian, Ubuntu), macOS, and Windows. In reality, the majority of Linux and macOS variants include Git pre-installed!

Checking if Git has been installed

To determine if Git is already installed on your system, follow these steps based on your operating system:

Linux (Rocky Linux/RHEL/CentOS/Ubuntu/Debian):

Open Terminal: Use any of the terminal application.

Check Git Version:git version Use this command to verify if Git is installed on your Linux system.

git Version check


Open Terminal: Use any of the terminal application.

Check Git Version:git version This command will display the installed Git version or indicate that git is not recognized.


Open Command Prompt or Git Bash: Use either the standard command prompt or the “Git Bash” terminal.

Verify Git Installation: git version Running this command will show the Git version if Git is installed, or prompt that git is an unknown command if Git is not installed.

Installing Git on Linux (Rocky Linux, RHEL, CentOS, Debian, Ubuntu)

Using APT (Advanced Package Tool)

Open a terminal and run:

sudo apt update
sudo apt install git

Using YUM or DNF

Open a terminal and run:

For RHEL/CentOS 7, Fedora 21 and earlier

sudo yum install git

Rocky Linux 8, RHEL/CentOS 8, Fedora 22 and later

sudo dnf install git

Using Package Managers (Snap):

On some Linux distributions, you can install Git via Snap:

sudo snap install git

Along with the git package, there is also git-all package , which has all the sub-packages. Git, on the other hand, only has the main components and very few requirements. You can choose based on your requirement

Installing Git on Windows

For Windows users, Git can be installed using the following methods:

Using Git for Windows (Git Bash):

Download the Git for Windows installer from Git Downloads.

Run the installer and follow the installation steps.

Optionally, choose to add Git to the PATH for easier access from the command line.

Installing Git on macOS

Using Homebrew:

If you have Homebrew installed, open a terminal and run:

brew install git

Using Git Installer:

Download the Git installer for macOS from Git Downloads.

Run the installer and follow the installation steps.

Verifying Git Installation

After installing Git, verify the installation by running:

git version

This command should display the installed version of Git.

Configuring Git

Finally, configure Git with your name and email address:

git config --global "Your Name"
git config --global "[email protected]"

Replace "Your Name" and "[email protected]" with your actual details.

Now you have Git installed on your system and ready to use for version control. If you have any questions or encounter issues during installation, feel free to reach out for assistance. Happy coding!

Feel free to share this guide with others who are looking to install Git on their systems. Let me know if you have any further questions or need additional help!

See also: Other posts tagged in Git category

Got any queries or feedback? Feel free to drop a comment below!

Categorized in: