Home Coding & Scripting Installing and Setting Up Git on Windows, macOS, and Linux

Installing and Setting Up Git on Windows, macOS, and Linux

364
0

Git needs to be installed on your computer before you can start tracking changes, creating repositories, or working with GitHub.
The good news: installing Git is simple, and it takes only a few minutes on any operating system.

This guide explains exactly how to install Git on Windows, macOS, and Linux — step by step.


🪟 Installing Git on Windows

Git on Windows is installed using an easy setup wizard.
This process also includes Git Bash automatically.

Step-by-Step Instructions

  1. Go to the official Git website:
    👉 https://git-scm.com/downloads
  2. Under Windows, click Download.
  3. Open the downloaded installer.
  4. Click Next through the setup screens.
    The default options are perfect for beginners.
  5. When choosing the default editor, select:
    • Visual Studio Code (recommended)
    • or keep Vim if preferred
  6. When asked about the terminal, choose:
    • “Use Windows Terminal” or
    • “Use Git Bash only”
    Either option works — Git Bash is included automatically.
  7. Continue with the default settings and click Install.
  8. After installation, open Command Prompt, PowerShell, or Git Bash, and type: git --version

If Git is installed correctly, the version number will appear.


🍎 Installing Git on macOS

macOS users have three easy ways to install Git. Any method works fine.


Option 1: Install Git Using Xcode Command Line Tools (Recommended)

Open Terminal and run:

xcode-select --install

A popup will appear. Click Install.

This installs Git automatically.


Option 2: Install Git Using Homebrew

If Homebrew is installed, run:

brew install git

If Homebrew is not installed, install it first:

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

Then install Git using the first command.


Option 3: Install from Git’s Official Site

Download the macOS installer from:
👉 https://git-scm.com/download/mac

Follow the on-screen instructions.


Verify Installation

Open Terminal and run:

git --version

You should see the installed version.


🐧 Installing Git on Linux

Most Linux distributions come with Git preinstalled.
If not, you can install it using your package manager.


Ubuntu / Debian

Open Terminal:

sudo apt update
sudo apt install git

Fedora

sudo dnf install git

CentOS / RHEL

sudo yum install git

Arch Linux

sudo pacman -S git

Verify Git Installation

Run:

git --version

If Git is installed, the version number will appear.


📌 After Installing Git: Set Your Identity

Git uses your name and email to record who makes each commit.
This information appears in your commit history.


🌍 Set Your Global Identity (Recommended for Beginners)

This applies to all Git projects on your computer.

git config --global user.name "Your Name"
git config --global user.email "you@example.com"

Most beginners only need this global configuration.


📁 Set Identity Only for a Specific Project (Optional)

If you want different identity details for certain projects
(e.g., personal email for personal projects and work email for company projects),
you can set a local identity inside that project’s folder.

Important:

The folder must already be a Git repository before setting local config.

This means one of the following must be true:

  • The folder was created using: git init
  • OR the folder was created by cloning a repository: git clone <repo-url>

Steps to set local identity:

  1. Navigate to the project folder: cd path/to/project
  2. Set the project-specific identity: git config user.name "Project-Specific Name" git config user.email "project@example.com"

This identity applies only to this project and overrides the global settings.


🔎 How Git Chooses Which Identity to Use

Git checks settings in this order:

  1. Local config (project-level)
  2. Global config (user-level)
  3. System config (machine-level, rarely used)

So if a local identity exists, Git always uses that for this project.


🎯 Final Thoughts

Installing Git is the very first step in your version control journey.
Once Git is set up on your system, you’re ready to:

  • Create repositories
  • Track changes
  • Connect with GitHub
  • Use commands like add, commit, and push
  • Work with branches and collaboration tools

This simple setup unlocks everything that comes next in your Git learning path.

Previous articleWhat Is Git and Why Developers Use It
Next articleGit Repository Structure and Workflow Stages
Heartin Kanikathottu
As a seasoned Cloud and Security Architect, I’ve led transformative initiatives in key roles, including Vice President at Morgan Stanley, Principal Architect at Societe Generale, and Tech Lead & Cloud Security Architect at VMware, among others. I’m also an internationally published author with multiple books available on platforms like Amazon and O'Reilly. Notably, one of my books was recognized as the 8th best cloud computing book of all time in 2020, reflecting the impact of my contributions to the field. With over 15 professional certifications from providers such as Microsoft (Azure), Amazon (AWS), Oracle (Java), Pivotal (Spring), and IBM, I bring a wealth of expertise to my work. Academically, I hold dual Master’s degrees in Cloud Computing and Data Analytics. I’m passionate about sharing knowledge and mentoring others, which is why I actively speak at global technical forums such as Tech Opportunities Fest at Platform Calgary, Google's Kubernetes Meetup, Java User Group, Elasticsearch Meetup, and the Agile India Conference.

LEAVE A REPLY

Please enter your comment!
Please enter your name here