Prerequisite Setup

Git Setup And First-Time Configuration

Use this page before running Git CLI commands in the learning paths. It covers install, verification, identity config, and authentication setup.

Recommended flow: install Git, verify with git --version, configure identity, then set up SSH or HTTPS auth.

Install Git Client

Windows

Download and run the official Git for Windows installer.

Git for Windows installer

Optional automation: winget install --id Git.Git -e

macOS

Download and run the macOS installer package.

Git for macOS installer

Optional automation: brew install git

Ubuntu / Debian

Use apt package manager from terminal.

sudo apt update && sudo apt install git -y

RHEL / Fedora

Use dnf or yum based on distro version.

sudo dnf install git -y

Verify Installation And Identity

  1. 1 Confirm Git is installed and available in terminal.
    git --version
  2. 2 Set your commit author name once at global scope.
    git config --global user.name "Your Name"
  3. 3 Set your commit author email to match your Git host account.
    git config --global user.email "you@company.com"
  4. 4 Verify global config before cloning or pushing repositories.
    git config --global --list

Authentication Setup

Pick SSH if your team wants key-based auth with no repeated credential prompts. Pick HTTPS + PAT if your organization standardizes token-based access through credential manager.

SSH

  • Step 1: Generate an SSH key pair.
    ssh-keygen -t ed25519 -C "you@company.com"
  • Step 2: Start ssh-agent and add your private key.
    eval "$(ssh-agent -s)" && ssh-add ~/.ssh/id_ed25519
  • PowerShell alternative:
    Get-Service ssh-agent | Set-Service -StartupType Automatic; Start-Service ssh-agent; ssh-add $env:USERPROFILE\.ssh\id_ed25519
  • Step 3: Copy your public key and add it to your Git provider account.
    cat ~/.ssh/id_ed25519.pub
  • PowerShell alternative:
    Get-Content $env:USERPROFILE\.ssh\id_ed25519.pub
  • Step 4: Test SSH authentication.
    ssh -T git@github.com
  • Step 5: Ensure your repository remote uses SSH URL format.
    git remote set-url origin git@github.com:ORG/REPO.git
    git remote -v

HTTPS + Personal Access Token

  • Step 1: Use an HTTPS remote URL.
    git remote -v
  • Step 2: Enable Git Credential Manager (recommended helper).
    git config --global credential.helper manager
  • If your Git version expects older naming, use:
    git config --global credential.helper manager-core
  • Step 3: Create a PAT in your Git provider with least-privilege scopes (repo read/write as needed).
  • Step 4: Run a Git network command and sign in when prompted.
    git fetch origin
  • Use your Git username, then paste PAT when prompted for password. Credential Manager stores it securely.
  • Step 5: Verify configured helper.
    git config --global credential.helper

Reference Docs