Installing Git comes down to one installer or one command, depending on what you run. Windows has the Git for Windows installer and winget. On a Mac you use Homebrew or the Xcode Command Line Tools, and on Linux it’s apt or dnf.
Git itself is a distributed version control system. It records changes to source code, and the command-line client behaves the same everywhere. Run git --version when you’re done to confirm it worked.
Windows has a quirk worth knowing early. Git for Windows is a separate project from Git itself, per the Pro Git book on git-scm.com. It has its own installer, its own release notes and a bundled Git Bash terminal.
How do you check whether Git is already installed?
Open a terminal and run git --version. If it prints something like “git version 2.56.0”, Git is already on the machine. If it throws an error, pick one of the installs further down.
Where you open that terminal depends on the system. On Windows, use PowerShell or Command Prompt. A missing install gives “‘git’ is not recognized as an internal or external command” in Command Prompt, while PowerShell says the term ‘git’ is not recognized.
On a Mac, Terminal does the job. If Git is missing, macOS pops up a prompt offering the Xcode Command Line Tools. Linux users can open any terminal, and “command not found” means Git isn’t there, although plenty of distributions ship it already.
One thing trips people up on Macs. If the version string ends in “Apple Git”, Apple’s own build answered. That’s a third-party distribution, and git-scm.com warns that those can lag behind the source release.
Compare your number with the current release. git-scm.com lists 2.56.0 as the latest version, and the Git for Windows build of it is dated 28 September 2026.
Which Git installation method fits your system?

It depends on your operating system and how current you want Git to be. Windows users should take the official installer. Mac users are better off with Homebrew, and Linux users can stick with the distribution package unless they’re on Ubuntu and want something newer (more on that below).
| Platform | Method | Version currency | Best for |
|---|---|---|---|
| Windows | Git for Windows installer or winget | Follows upstream closely | Nearly everyone |
| macOS | Xcode Command Line Tools | Apple’s build, can lag | Quick start |
| macOS | Homebrew | Usually close to upstream | Developers who want updates |
| Linux | Distribution package | Fixed per release | Servers, stable setups |
| Ubuntu | git-core PPA | Latest stable upstream | Newer Git on an LTS release |
If you’re new to Git, take your platform’s default route and stop there. A source build is overkill for a first install.
Distribution packages freeze at whatever version shipped with the release. Ubuntu 24.04 LTS carries Git 2.43.0, and Ubuntu 22.04 LTS carries 2.34.1, according to the Ubuntu package archive. Upstream is at 2.56.0.
That gap rarely breaks daily work. It starts to hurt when a tool or tutorial relies on a newer Git option.
If you need the newest release on Linux, add the PPA on Ubuntu or a third-party repository on the RHEL family. Compile from source only when no repository can supply the version.
How to install Git on Windows
Download the installer from git-scm.com, run it, and keep the PATH choice that exposes Git to the command line and to other programs. The package also installs Git Bash, Git GUI and Git Credential Manager, according to the Git for Windows project.
Windows 8.1 on x64 is the floor. Git for Windows 2.46.2 was the last release that ran on Windows 7 and 8, and 2.40.1 was the last with full 32-bit support, per the project’s FAQ.
Running the Git for Windows installer
The x64 and ARM64 builds are separate downloads, so a Windows on ARM machine needs the ARM64 installer.
- Download the installer from git-scm.com/install/windows.
- Run the .exe, accept the license and keep the default install folder.
- Keep the default components unless you don’t want Git Bash or the right-click Explorer shortcuts.
- Work through the wizard screens (the notes below cover the ones worth reading).
- Click Install, then Finish.
- Open a new PowerShell window (old windows keep the old PATH) and run
git --version.
A few wizard screens deserve more than a blind click on Next. On the PATH screen, choose “Git from the command line and also from 3rd-party software”, which works in PowerShell, Command Prompt and Git Bash alike.
For the default editor, pick whatever you already use, Visual Studio Code or Notepad++ for example. The line-ending default converts to Windows style on checkout and Unix style on commit, and you should only change it if your team has a line-ending policy.
The default branch name can stay on “Let Git decide”, or you can override it to main (that needs Git 2.28 or later). Git Credential Manager is the credential helper, and it signs you in to GitHub, Azure Repos and other hosts.
Installing Git with winget or Chocolatey
Package managers skip the wizard and install the same package with default options.
With winget, run winget install --id Git.Git -e --source winget from Command Prompt or PowerShell, then reopen the terminal so the PATH refreshes.
Chocolatey works from an elevated PowerShell with choco install git -y. That package is community maintained.
There’s also a portable edition (x64 and ARM64) that runs from a folder such as a USB drive, no wizard needed. Git for Windows doesn’t ship an MSI, so Group Policy rollouts need the exe installer, the portable package or the Chocolatey package, per the Git for Windows FAQ.
How to install Git on macOS
The fastest route is xcode-select --install, which pulls Apple’s own build. Homebrew gets you a newer one with brew install git.
The Command Line Tools don’t require the full Xcode app. For Homebrew, install it from brew.sh first. MacPorts users can run sudo port install git.
The old standalone macOS installer is gone. git-scm.com says the third-party installer stopped at Git 2.33.0 in 2021 and is no longer linked, so any guide that sends you to a .dmg or .pkg download there is out of date.
Two builds can live on one Mac, and whichever sits earlier in your PATH wins. Run which git afterward to see which one you’ve got.
A result of /opt/homebrew/bin/git (Apple silicon) or /usr/local/bin/git (Intel) means the Homebrew build is active. If it says /usr/bin/git, Apple’s build is answering.
How to install Git on Linux
Use your distribution’s package manager. On Debian or Ubuntu, sudo apt install git does the whole job.
| Distribution | Command |
|---|---|
| Debian, Ubuntu | sudo apt install git |
| Fedora | sudo dnf install git |
| Arch Linux | sudo pacman -S git |
| openSUSE | sudo zypper install git |
Confirm the result with git --version.
Ubuntu users who want the latest stable upstream release should add the git-core PPA first. Run sudo add-apt-repository ppa:git-core/ppa, then sudo apt update and sudo apt install git.
RHEL and its derivatives typically ship older Git versions, according to git-scm.com. The fixes are a third-party repository (git-scm.com names the IUS Community Project) or a source build.
Inside Windows Subsystem for Linux, run the same apt command in the Linux distribution. That copy is separate from Git for Windows, so each one keeps its own version and configuration.
When should you build Git from source?
Only when no package, installer or repository offers the version you need. Every other case is easier with a package manager.
The usual trigger is a server or RHEL-family system whose repositories stop at an old release. Wanting a custom install prefix is the other reason.
According to the INSTALL file in the Git source tree, the build needs zlib (Git won’t build without it), libcurl 7.61.0 or later for http and https remotes, and Perl 5.26.0 or later for git send-email and git svn. It also needs a POSIX shell and ssh.
Expat, gettext and Tcl/Tk are optional. They cover DAV pushes, translations, gitk and git-gui, and each can be dropped with a NO\_ flag on the make line, such as NO\_TCLTK=YesPlease or NO\_GETTEXT=YesPlease.
Download the tarball from kernel.org (git-scm.com links to it), unpack it, then run make prefix=/usr/local all followed by sudo make prefix=/usr/local install.
Use the same prefix in both commands. The INSTALL file warns that building with one prefix and installing with another doesn’t work, because paths are compiled into the binaries.
Plain make and make install, with no prefix, put Git in ~/bin in your home directory and need no root access. The default build also skips the documentation, which needs the asciidoc and xmlto toolchain.
What you get for the trouble is the newest upstream release on any distribution, a root-free install into ~/bin if you want one, and the option to leave out libraries you don’t need.
What you pay is steeper. Nothing updates automatically, so every new release means another rebuild. You’ll hunt down development packages before the first build even starts, the documentation needs its own toolchain, and a copy in /usr/local/bin can shadow the packaged Git in your PATH.
On a laptop, skip it. On a locked-down server with stale repositories, it’s the fallback.
How to configure Git after installing
Set your name and email with git config --global before the first commit. After that, add an editor and a default branch name, and check the result with git config --list --show-origin.
The git config command writes to one of three files, and each level overrides the one above it, according to the Pro Git book.
| Level | Flag | File |
|---|---|---|
| System | –system | [path]/etc/gitconfig, relative to the install folder (admin rights needed) |
| Global | –global | ~/.gitconfig or ~/.config/git/config |
| Local | –local (the default) | .git/config inside the repository |
On Windows, the global file sits in your home folder (C:\Users\yourname for most people). The system-level file lives in C:\ProgramData\Git\config and only changes through an elevated git config -f.
Your identity comes first. Run git config --global user.name "Your Name", then git config --global user.email "you@example.com", since every commit records both values.
For the default branch, git config --global init.defaultBranch main sets the initial name for new repositories. The editor is git config --global core.editor followed by the editor command. Without it, Git falls back to the system default, and on Windows the value needs the full path to the executable.
Drop –global inside a repository to override a value for that project only. User-level settings survive upgrades, so this is a one-time job per machine.
Remotes add one more layer. HTTPS remotes authenticate through a credential helper, and SSH remotes through a key pair.
How to update or uninstall Git
Update Git with the tool that installed it, and remove it the same way. Mixing tools leaves two copies on one machine.
| Installed with | Update | Uninstall |
|---|---|---|
| Git for Windows installer | git update-git-for-windows, or run the new installer | Windows Settings, Apps |
| winget | winget upgrade –id Git.Git | winget uninstall –id Git.Git |
| Homebrew | brew update && brew upgrade git | brew uninstall git |
| apt (Debian, Ubuntu) | sudo apt update && sudo apt install –only-upgrade git | sudo apt remove git |
| dnf (Fedora) | sudo dnf upgrade git | sudo dnf remove git |
On Windows, git update-git-for-windows checks for a newer release and offers to install it, whether or not you enabled auto-updates during setup. Customizations survive a reinstall as long as they live in the configuration folders, per the Git for Windows FAQ.
The same FAQ calls upgrading “highly advisable” for any build older than 2.55.0(4), because of security-relevant fixes. New major Git versions land about every 12 weeks, and Git for Windows typically follows within a day.
Before a bulk update, run winget upgrade with no arguments to list what will change before you add –all. Pinned packages are skipped unless you pass –include-pinned, according to Microsoft Learn.
Your user-level .gitconfig lives in your home directory, not in the install folder. After an uninstall it’s a separate file you’ll have to keep or delete yourself.
Why is Git not working after installation?
A stale PATH causes most post-install failures. Open a new terminal window before trying anything else, because a terminal reads PATH only when it starts.
On Windows, “git is not recognized” usually means the terminal predates the install or the PATH option got skipped. Re-run the installer and pick the recommended PATH option if a fresh window still fails.
“Command not found” on macOS or Linux points to an install that didn’t finish, or a shell that hasn’t reloaded. Reopen the terminal and run the install command again.
“Permission denied” means the package install needs admin rights. Put sudo in front of the Linux and macOS package commands, or use an elevated PowerShell for Chocolatey.
On Debian or Ubuntu, “Unable to locate package git” just means the package index is stale. Run sudo apt update, then sudo apt install git.
Fixing PATH by hand is where guides disagree. DeployHQ names C:\Program Files\Git\cmd as the folder to add, while W3Schools names C:\Program Files\Git\bin in its troubleshooting entry and both the bin and cmd folders in its PATH walkthrough.
Skip the guesswork. Re-run the installer with the recommended PATH option so it sets the folder itself, then confirm with where git.
An old version that survives an upgrade means two copies of Git sit on PATH and the older one wins. On Windows, where git lists every match, and on macOS and Linux which -a git does the same.
Run git --version against the first entry, then remove or reorder the stale one. If git --version prints a version number, the install works, and anything else is a PATH problem until proven otherwise.
Git Installation FAQ
Is Git free to install?
Yes. Git is open source under the GNU General Public License version 2, according to the Git for Windows release notes, so there’s no license fee on Windows, macOS or Linux.
What is the difference between Git and GitHub?
Git runs on your machine and tracks file versions in a repository. GitHub hosts Git repositories and adds pull requests and other collaboration tools on top.
You don’t need a hosting account to use Git locally, as the VS Code documentation notes. The difference between Git and GitHub starts to matter once you push code to a remote.
Do I have to install Git before using Visual Studio Code?
Yes. VS Code has built-in Git support, but every Git operation runs through the Git installation already on your machine.
The editor and the command line share the same repository, so you can switch between them freely.
Does GitHub Desktop install Git too?
It does when Git is missing. GitHub’s Git guides say installing GitHub Desktop also installs the latest version of Git if you don’t have it.
For terminal work, the standalone installers are still the direct route.
Can I install Git on Windows without admin rights?
Yes, through the portable edition. Download PortableGit (x64 or ARM64) from git-scm.com, unpack it into a folder you own, add its bin directory to your user PATH, and confirm with git --version.
Should I use Git Bash or PowerShell?
Either works once the recommended PATH option is set. PowerShell suits native Windows tools, and Git Bash suits Unix-style commands.
Git Bash runs in mintty, and the Git for Windows FAQ says some native console programs, interactive ones in particular, misbehave there. The winpty utility is the documented workaround.
Connecting Git to GitHub With an SSH Key
A fresh Git installation authenticates to GitHub with an SSH key pair. You generate the key, load it into the ssh-agent, then add the public half to your account.
Run ssh-keygen -t ed25519 -C "your_email@example.com" to create it. GitHub dropped DSA keys on March 15, 2022, and legacy systems without Ed25519 support need ssh-keygen -t rsa -b 4096 instead.
Windows adds one trap. Git for Windows bundles its own ssh.exe, which can’t reach the Windows ssh-agent service, so Git may keep asking for the passphrase during operations such as git push, according to GitHub Docs.
Setting core.sshCommand to C:/Windows/System32/OpenSSH/ssh.exe fixes it. The cost is two SSH clients to keep straight on one machine.
The walkthrough to add an SSH key to GitHub covers the account side step by step.
- MongoDB Cheat Sheet - October 20, 2026
- Adding AI Video Generation to a Software Product: Architecture, Cost Guardrails and QA - October 20, 2026
- Show Hidden Characters, Spaces, and Line Endings in Notepad++ - October 19, 2026




