Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
A step-by-step guide to Git installation
Development Tools

A step-by-step guide to Git installation

How to install Git on macOS, Windows and Linux

Kyryl Sidak

by Kyryl Sidak

Data Scientist, ML Engineer

Nov, 2023
8 min read

facebooklinkedintwitter
copy
A step-by-step guide to Git installation

Version control systems are essential for developers to keep track of all the changes they make to their files with code and other types of files.

Git is the most popular version control system that plays a crucial role in modern software development. Whether you're a seasoned developer or just getting started, installing Git is the first step to harnessing its capabilities.

In this guide, we'll walk you through the installation process on three major operating systems: macOS, Windows, and Linux.

Here some useful links:

Installing Git on Mac

Checking for Existing Git

Before you begin, you should check if Git is already installed on your Mac. First, open the Terminal:

  1. Press Command (⌘) + Space simultaneously. This will open Spotlight, a system-wide search feature.
  2. Type "Terminal" in the search bar, and you'll see "Terminal" or "Terminal.app" as one of the results.
  3. Click on "Terminal" in the search results. This will open the Terminal application.
Finding Terminal

Now type the git --version command in the Terminal and press the Return key:

Checking git version

Note

Typing a command in the Terminal and pressing the Return key is called running the command.

If Git is already installed, you'll see the version number. If not, the system will prompt you to install it and you should just follow the instructions. If it is not the case, we will discuss another installation option in the next step.

Installing Git via Homebrew

If you already have homebrew installed, you can simply run the brew install git command in the Terminal window. If you don’t have homebrew installed yet, here are the steps to install it:

Step 1: Run the following command in the Terminal:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Homebrew installation

Step 2: Type the password for your computer and press the Return key

Entering password

Step 3: Press the Return key

Pressing the return key

Step 4: Run two commands from the "Next steps" section

As you can see, the "Next steps" section prompts you to run two commands. Each command is written from the new line. Commands for my Mac are the following:

First command:

(echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> /Users/sidak.kryryl/.zprofile

Second command:

eval "$(/opt/homebrew/bin/brew shellenv)"

The first command, however, will look different for you, so copy it from the "Next steps" section, paste it in the Terminal and press the Return key. Then copy and paste the second command and press the Return key:

Next steps commands

Step 5: Run the brew help command to verify that brew is installed

Brew help

Step 6: Run the brew install git command to install Git and then run git --version to verify that Git has been installed

Git installation via homebrew Installation verification

Run Code from Your Browser - No Installation Required

Run Code from Your Browser - No Installation Required

Installing Git on Windows

Step 1: Choose Installer

Visit the official Git website to download the Git for Windows installer. In the “Standalone Installer” section choose and click on the appropriate installer for your Windows (32-bit for 32-bit Windows or 64-bit for 64-bit Windows):

Choosing an installer

We’ll use the 64-bit installer, however, the installation process for the 32-bit version is the same.

Step 2: Run the Installer

Double-click the downloaded installer to launch it. You'll be presented with the installation wizard where you should click "Install":

Installation wizard

Step 3: Configure Installation

The default settings should work well for most users, so feel free to click "Next" throughout the installation.

Step 4: Select destination location

Select destination location

Step 5: Select components

Select components

Step 6: Select start menu folder

Select start menu folder

Step 7: Choose the default text editor

The default text editor used by Git for Windows is Vim, however, you can change it to Nano, for example, or the one that suits you most:

Choosing the default editor

Step 8: Adjust the name of the initial branch

Adjusting the name of the initial branch

Step 9: Adjust your PATH environment

Adjusting your PATH environment

Step 10: Choose the SSH executable

Choosing the SSH executable

Step 11: Choose HTTPS transport backend

Choosing HTTPS transport backend

Step 12: Configure the line ending conversions:

Configuring the line ending conversions

Step 13: Configure the Terminal emulator to use with Git Bash

Configuring the Terminal emulator to use with Git Bash

Step 14: Choose the default behaviour of git pull

Choosing the default behaviour of git pull

Step 15: Choose a credential helper

Choosing a credential helper

Step 16: Configure extra options

Configuring extra options

Step 17: Click "Install" to install Git

Installing Git

Step 18: Finish Installation

Finishing Git installation

Step 19: Verify Git Installation

Open the Command Prompt:

  1. Open the Start menu or press the Windows key + R.
  2. Type cmd or cmd.exe in the Run command box.
  3. Click "Ok".
Finding the command prompt

Run git --version in the Terminal:

Installation verification

If Git is installed, you'll see the version number.

Installing Git on Linux

Step 1: Visit the official website

Step 2: Choose the command which corresponds to your Linux distribution

Step 3: Run the command in the Terminal

Step 4: Run git --version in the Terminal to verify that Git is installed

Start Learning Coding today and boost your Career Potential

Start Learning Coding today and boost your Career Potential

FAQs

Q: What's the purpose of installing Git?
A: Installing Git is essential for version control, enabling developers to track and manage changes in their code and collaborate effectively.

Q: How do I check if Git is already installed on my Mac?
A: Open the Terminal and type git --version, press Enter. If Git is installed, it will display the version number.

Q: Can I install Git on Mac using Homebrew?
A: Yes, if you have Homebrew, you can run brew install git in the Terminal. If you don't have Homebrew, the article provides step-by-step instructions for its installation.

Q: What's the installation process for Git on Windows?
A: Visit the official Git website, download the installer for your Windows version, and follow the installation steps, as outlined in the article.

Q: How can I verify the installation of Git on Windows?
A: Open Command Prompt, type git --version, and press Enter. If Git is installed, it will show the version number.

Q: How do I install Git on Linux?
A: The article explains the steps for different Linux distributions. You need to visit the official website, choose the command for your distribution, and run it in the Terminal.

Was this article helpful?

Share:

facebooklinkedintwitter
copy

Was this article helpful?

Share:

facebooklinkedintwitter
copy

Content of this article

We're sorry to hear that something went wrong. What happened?
some-alt