-
Notifications
You must be signed in to change notification settings - Fork 8
Git for Windows
Below is a video walkthrough of the steps on this page:
OSDWorkspace Prerequisites: Git for Windows
winget install -e -h --id Git.GitAfter 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"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.
Standard installation (silent):
winget install -e -h --id Git.GitAccept agreements non-interactively:
winget install -e -h --id Git.Git --accept-source-agreements --accept-package-agreementswinget show --id Git.Git --versionswinget show --id Git.Gitwinget upgrade -e -h --id Git.GitOpen a new PowerShell window and run:
git --versionOr 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
}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.nameTo use main as the default branch name for new repositories (recommended):
git config --global init.defaultBranch mainTo ensure consistent line endings on Windows:
git config --global core.autocrlf truegit config --global --listUse 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