Git works on Windows, macOS, and Linux. Install it with the method supported by your operating system, then verify the command and set the identity stored in your commits.
Current release: The official Git site lists Git 2.55.0 as the latest source release. Your package manager may provide a different supported version.
Install Git on Windows
You can use the official Git for Windows installer or Windows Package Manager.
Install with winget
Open PowerShell or Command Prompt and run:
Command:
winget install --id Git.Git -e --source winget
Close and reopen the terminal after the installation finishes.
Install with the setup program
- Open the official Git for Windows page.
- Download the x64 or ARM64 installer that matches your computer.
- Run the installer and keep the recommended defaults unless your organization requires different settings.
- Allow Git to run from the command line and third-party software when the installer asks about PATH.
Verify Git on Windows
Command:
git --version
Example output:
git version 2.55.0.windows.1
The exact version can differ. A version line confirms that the terminal can find Git.
Install Git on macOS
On macOS, install Git with Homebrew or Apple's Xcode Command Line Tools. The old standalone macOS installer is no longer maintained.
Install with Homebrew
If Homebrew is already available, run:
brew install git
If you do not use Homebrew, install Apple's command-line tools instead:
xcode-select --install
A macOS dialog opens and guides you through the installation.
Verify Git on macOS
git --version
Example output:
git version 2.55.0
Tip: Homebrew and Apple may package different Git versions. Use the version supplied by the installation method you chose.
Install Git on Linux
Use your distribution's package manager. The package name is usually git.
Debian and Ubuntu
sudo apt update
sudo apt install git
Fedora
sudo dnf install git
Arch Linux
sudo pacman -S git
openSUSE
sudo zypper install git
Verify Git on Linux
git --version
Example output:
git version 2.55.0
Your distribution may ship an older supported release. Check its package documentation when you need a feature introduced in a newer Git version.
Configure Your Commit Identity
Git records a name and email address in every commit you create. Set the values once for your user account:
# Set the author name stored in new commits
git config --global user.name "Aarav Sharma"
# Set the author email stored in new commits
git config --global user.email "[email protected]"
Check both values and the configuration files that provide them:
git config --list --show-origin
Example output:
file:C:/Users/Aarav/.gitconfig user.name=Aarav Sharma
file:C:/Users/Aarav/.gitconfig [email protected]
Paths use a different format on macOS and Linux. If a project needs another identity, run the same commands without --global inside that repository.
Set the Initial Branch Name
Git 2.x still defaults to master unless you configure another name. Set main for future repositories:
git config --global init.defaultBranch main
You can also choose the branch while creating one repository:
git init -b main
Example output:
Initialized empty Git repository in /path/to/project/.git/
Conclusion
You can install Git with an official installer or your operating system's package manager. Verify it with git --version, configure your commit identity, and choose the initial branch name before creating repositories.