Mac OS

Homebrew

Install using Homebrew (recommended)

  • Install Homebrew if you don’t have it:
    1
    
    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
    
  • Open the Terminal and Install Git:
    1
    
    brew install git
    

MacPorts

Install using MacPorts

Xcode

Install Using Xcode

  • Open the Terminal.
  • Run the following command:
    1
    
    xcode-select --install
    
  • Follow the on-screen instructions to install the Command Line Tools.
  • After installation, you can use Git from the Terminal.

Linux

Installing Git on Linux involves different steps for each Linux Distribution. Here’s a guide for each distro:

Arch

  • Open the Terminal
  • Run the following command:
    1
    
    sudo pacman -S git
    

Debian

  • Open the Terminal
  • Run the following commands:
    1
    
    sudo apt install git
    

Fedora

(Fedora 22 and later)

  • Open the Terminal
  • Run the following command:
    1
    
    sudo dnf install git
    

Ubuntu

For Ubuntu, this PPA provides the latest stable upstream Git version

  • To add PPA open the Terminal & Run the following commands:
    1
    
    add-apt-repository ppa:git-core/ppa
    
  • Run the following commands:
    1
    
    sudo apt update && sudo apt upgrade -y && sudo apt install git -y
    

Windows

Official Website

  • Visit the official Git website: Git for Windows.
  • Click on the “Download” button to download the installer.
  • Run the downloaded executable file.

Using Package Manager

Chocolatey

To install Git, run the following command from the Terminal:

1
choco install git

Scoop

To install Git, run the following command from the Terminal:

1
scoop bucket add main
1
scoop install main/git

Winget

❗Official Package Manager for Microsoft Windows

To install Git, run the following command from the Terminal:

1
winget install -h -e -s winget --id Git.Git

References