GIT Installation

GIT Installation

GIT Installation

Introduction

GIT is available on all major operating systems. This lesson covers installation on Ubuntu (including WSL), Windows, and macOS.

Installing GIT on Ubuntu (WSL)

Method 1: Using APT Package Manager

The easiest way to install GIT on Ubuntu is through the package manager:

sudo apt update
sudo apt install git

Verify the installation:

git --version

You should see output similar to: git version 2.34.1

Method 2: Installing Latest Version from PPA

For the latest features, install from the official GIT repository:

sudo add-apt-repository ppa:git-core/ppa
sudo apt update
sudo apt install git

Installing on WSL

If you are using Windows Subsystem for Linux (WSL), the commands are exactly the same as Ubuntu:

1. Open your WSL terminal (Ubuntu, Debian, or other distribution) 2. Run the commands above 3. GIT is now available in your WSL environment

You can access your Windows files from WSL at /mnt/c/.

Installing GIT on Windows

Method 1: Official Installer

1. Download GIT from the official website: https://git-scm.com/download/win 2. Run the installer 3. Follow the installation wizard

Recommended settings:

  • Editor: Use your preferred editor (VS Code recommended)
  • PATH: Select "Git from the command line and also from 3rd-party software"
  • HTTPS: Use the OpenSSL library
  • Line Endings: Select "Checkout Windows-style, commit Unix-style line endings"

Method 2: Using Chocolatey

If you have Chocolatey package manager:

choco install git

Method 3: Using Winget

winget install Git.Git

Installing GIT on macOS

Method 1: Using Homebrew

brew install git

Method 2: Using XCode Command Line Tools

xcode-select --install

Method 3: Official Installer

Download from: https://git-scm.com/download/mac

Verifying Installation

After installation, verify that GIT is working:

git --version

This should display the installed version number.

Configuration After Installation

Once GIT is installed, you need to configure your identity:

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

This information will be attached to every commit you make.

Summary

Installing GIT is straightforward across all platforms:

  • Ubuntu/WSL: Use apt install git
  • Windows: Download installer from git-scm.com or use package managers
  • macOS: Use Homebrew or XCode tools
After installation, always configure your user name and email.

Next Lesson

The next lesson covers initial configuration options and setting up GIT for optimal use.

Quiz - Quiz - GIT Installation

1. What is the command to install GIT on Ubuntu using apt?

2. What command verifies that GIT is installed correctly?

3. Which package manager can be used to install GIT on Windows?

4. What should you configure after installing GIT?

5. Which command adds the official GIT PPA on Ubuntu?

What is GIT and Why Use It