Skip to content

Git for Windows

Your Name edited this page Mar 29, 2026 · 9 revisions

Walkthrough Video

Below is a video walkthrough of the steps on this page:

OSDWorkspace Prerequisites: Git for Windows

Quick Setup

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

After installing Git, open a new PowerShell window (so git.exe is on the PATH) and set your global identity:

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

Installing Git for Windows

Refer to the official Git for Windows documentation for full details.

Current Version: Git for Windows 2.53.0(2) — Release Notes

Security Note: Version 2.53.0(2) is a security fix release that addresses CVE-2025-66413, which could allow NTLM credential disclosure when cloning from an attacker-controlled server. Ensure you are running 2.53.0(2) or later.

Install using winget

Standard installation (silent):

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

Accept agreements non-interactively:

winget install -e -h --id Git.Git --accept-source-agreements --accept-package-agreements

Check available versions

winget show --id Git.Git --versions

Check currently installed version

winget show --id Git.Git

Updating Git for Windows

winget upgrade -e -h --id Git.Git

Post-Installation Steps

1. Verify the installation

Open a new PowerShell window and run:

git --version

Or use PowerShell to check programmatically:

$git = Get-Command git -ErrorAction SilentlyContinue
if ($git) {
    Write-Host "Git installed: $(git --version)" -ForegroundColor Green
} else {
    Write-Host "Git is not installed or not on the PATH." -ForegroundColor Yellow
}

2. Configure your global identity

Git requires a name and email address for every commit. Set these once globally:

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

To verify your settings:

git config --global user.email
git config --global user.name

3. Set the default branch name

To use main as the default branch name for new repositories (recommended):

git config --global init.defaultBranch main

4. Configure line endings (Windows)

To ensure consistent line endings on Windows:

git config --global core.autocrlf true

5. View your full global configuration

git config --global --list

Interactive Identity Setup Script

Use this script to interactively review and update your global Git identity:

# Check and set user.email
$currentEmail = git config --global user.email
if ([string]::IsNullOrWhiteSpace($currentEmail)) {
    $userEmail = Read-Host "Enter your Git email address"
    git config --global user.email "$userEmail"
    Write-Host "Set git user.email to $userEmail" -ForegroundColor Green
} else {
    Write-Host "Current git user.email: $currentEmail" -ForegroundColor Yellow
    $changeEmail = Read-Host "Do you want to change it? (y/n)"
    if ($changeEmail -eq 'y') {
        $userEmail = Read-Host "Enter your new Git email address"
        git config --global user.email "$userEmail"
        Write-Host "Updated git user.email to $userEmail" -ForegroundColor Green
    }
}

# Check and set user.name
$currentName = git config --global user.name
if ([string]::IsNullOrWhiteSpace($currentName)) {
    $userName = Read-Host "Enter your Git user name"
    git config --global user.name "$userName"
    Write-Host "Set git user.name to $userName" -ForegroundColor Green
} else {
    Write-Host "Current git user.name: $currentName" -ForegroundColor Yellow
    $changeName = Read-Host "Do you want to change it? (y/n)"
    if ($changeName -eq 'y') {
        $userName = Read-Host "Enter your new Git user name"
        git config --global user.name "$userName"
        Write-Host "Updated git user.name to $userName" -ForegroundColor Green
    }
}

# Show final identity
$finalEmail = git config --global user.email
$finalName  = git config --global user.name
Write-Host "`nYour global Git identity is now:" -ForegroundColor Cyan
Write-Host "  Name : $finalName"  -ForegroundColor White
Write-Host "  Email: $finalEmail" -ForegroundColor White

Additional Resources