wingetsilent-installgittutorial
中文Git

How to Install Git Silently with winget on Windows

Install Git for Windows silently with winget — single-line command for unattended setups, with custom options and uninstall flags. GPL-2.0 licensed.

· 3 min read · updated May 29, 2026

Git is a non-negotiable for any developer machine. Here's the cleanest way to install Git for Windows silently with winget, including custom configuration overrides for team-wide standardisation.

TL;DR

Open Terminal as Administrator and run:

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

Git for Windows installs with default settings: main as default branch, Vim as commit editor, Git Credential Manager enabled, OpenSSH for transport. Ready to git clone in 30 seconds.

What gets installed

Field Value
Package ID Git.Git
Publisher The Git Development Community
Installer type Inno Setup
License GPL-2.0
Latest version 2.54.0 (April 2026)
Homepage gitforwindows.org
Default install path C:\Program Files\Git

The installer registers:

  • git, git-bash, git-gui on PATH
  • Right-click "Git Bash Here" context menu
  • Optional shell integration (depends on flags)

Customising the silent install

Git for Windows' Inno Setup installer accepts a /COMPONENTS= flag to enable optional features. Pass it via --override:

winget install --id Git.Git -e --override "/VERYSILENT /NORESTART /COMPONENTS=icons,ext\reg\shellhere,ext\reg\guihere,assoc,assoc_sh"

Common component values:

Component What it enables
icons Start Menu shortcuts
ext\reg\shellhere "Git Bash Here" right-click
ext\reg\guihere "Git GUI Here" right-click
assoc Associate .git* config files
assoc_sh Associate .sh files with Bash
gitlfs Install Git LFS
windowsterminal Install Windows Terminal profile
scalar Microsoft Scalar tool

Configure Git after install

Once Git installs silently, set your identity:

git config --global user.name  "Your Name"
git config --global user.email "you@example.com"
git config --global init.defaultBranch main
git config --global pull.rebase true
git config --global core.autocrlf input

For a team-standard setup, include these in your provisioning script.

Variations

Specify version

To freeze on a known-good Git version (some CI systems are picky):

winget install --id Git.Git -e --version 2.54.0 --silent

List versions:

winget show --id Git.Git --versions

Pin to current major

After install, prevent winget upgrade from jumping major versions:

winget pin add --id Git.Git --version "2.*"

See winget pin guide.

Verify

git --version
# git version 2.54.0.windows.1

If git isn't recognized in a new Terminal, the PATH update hasn't propagated — close + reopen Terminal.

Upgrade silently

winget upgrade --id Git.Git -e --silent --accept-package-agreements --accept-source-agreements

Or as part of a weekly cron:

winget upgrade --all --silent --include-unknown

See How to update all Windows apps.

Uninstall silently

winget uninstall --id Git.Git --silent --disable-interactivity

Detailed guide: How to uninstall Windows apps with winget.

In a developer-machine script

PowerShell snippet for setting up a Git-ready dev environment:

# Install Git + companions silently
$apps = @(
  "Git.Git",
  "GitHub.cli",
  "Microsoft.WindowsTerminal",
  "Microsoft.VisualStudioCode"
)

foreach ($id in $apps) {
  winget install --id $id -e --silent `
    --accept-package-agreements --accept-source-agreements
}

# Configure Git
git config --global user.name  "$env:USERNAME"
git config --global user.email "$env:USERNAME@example.com"
git config --global init.defaultBranch main
git config --global pull.rebase true

# Set up GitHub auth
gh auth login --web

Full dev setup: Setting up a Node.js dev environment or Python dev setup.

Common errors

"Git is already installed" — winget detects existing install. Force-reinstall:

winget install --id Git.Git -e --silent --force

Old Git keeps showing as outdated even after upgrade — duplicate install (vendor website + winget). See winget upgrade not working fix.

"Installer hash does not match" — manifest lag after publisher release. Wait 24h or --force. See hash mismatch fix.

See also

Continue reading