Published in Articles on by Michiel van Oosterhout ~ 7 min read
Git was originally designed to be used for the Linux kernel, and is most at home on Linux (or on a Unix operating system like macOS). In Installing Git on Windows we installed Git for Windows, which is the officially sanctioned Git distribution for the Windows operating system, but not the only one. In this article we'll look at some of the other options for running Git on Windows?

Cross-platform programming
Let's first consider programs written in the C programming language, such as Git. When programming in C you will typically rely on an implementation of the C standard library. This is either present on the operating system, or you can bundle it with your program. A program using only the standard library will likely work on Linux, macOS, and Windows.
On Windows the C standard library is called Universal C Runtime (UCRT), and is included in the operating system (%SystemRoot%\System32\ucrtbase.dll
).
Software targeting Linux typically also relies the POSIX library, which makes porting to Windows more complex.

POSIX
The Portable Operating System Interface (POSIX) is a standard consisting of two parts. POSIX.1 is a superset of the C standard library. POSIX.2 prescribes an operating system shell and utilities 1 that must be present on a POSIX-compliant operating system. The shell is text-oriented (e.g. a command-line shell) and can interpret shell scripts. The utilities may be separate programs, or shell built-ins. Examples of utilities are simple programs like echo
and cat
, but also more complex programs like c99
(a C compiler) and vi
(an interactive text editor).
Some operating systems, like Apple's macOS are POSIX-certified, while other other operating systems, like Linux, are considered mostly compliant.
POSIX on Windows
On Windows the Universal C Runtime implements some of the POSIX.1 C library 2, but Windows does not include the POSIX.2 shell and utilities.
Several attempts at POSIX support have been undertaken by Microsoft over the years. The POSIX environment subsystem was included in the first versions of Windows NT, but did not include the POSIX.2 interactive user environment. It was replaced by Windows Services for UNIX, which did include a command-line shell and utilities, but is no longer available as of Windows 10.
WSL
Microsoft's latest attempt is the Windows Subsystem for Linux (WSL). WSL 1 is a real Windows subsystem but not 100% compatible with the Linux kernel. WSL 2 runs a real Linux kernel as a separate operating system in a virtual machine. Both can run unmodified ELF executables on Windows via wsl.exe
. WSL also includes bash.exe
, the Microsoft Bash launcher, which runs Bash using the default distribution 3.
Other attempts to bring POSIX support to Windows require that software is ported to target the custom POSIX environment.
Cygwin
The Cygwin project provides the cygwin1.dll
library to translate POSIX system calls to Windows kernel system calls. Programs that target Cygwin are distributed via Cygwin's package repository. To manage (install, update, remove) packages you must re-run the Cygwin setup. There is no official command-line package manager for Cygwin. The package repository includes ports of many if not all utilities required by POSIX.2, as well as 100s of ports of other software commonly found on Linux, including Git.

Cygwin includes a terminal (MinTTY) and runs the Bash command-line shell by default. For programs that target Cygwin, Windows drives like C:
are mapped to /cygdrive/c
, Cygwin's installation directory is mapped to /
, and /cygdrive/c/Users/$USER
is mapped to ~
. Cygwin includes cygpath.exe
to convert between Windows and POSIX paths.
MinGW with MSYS
MinGW (minimalist GNU for Windows) is focused on providing a Windows port of the GNU development toolchain on Windows, such that it can be used to build software that targets Windows. A command-line package manager mingw-get
is available, but the package repository is quite limited compared to Cygwin, and does not include Git.

When porting software to Windows, a POSIX-like environment may be needed during development. For this reason MinGW provides an optional package called MSYS (minimal system). MSYS provides the MSYS.dll
library (a fork of cygwin1.dll
) to translate POSIX system calls to Windows kernel system calls. The MSYS package includes a command-line shell (Bash) and a minimal set of utilities.
MinGW does not include a terminal. For programs that target MSYS, Windows drives like C:
are mapped to /c
, the MSYS installation directory is mapped to /
, and /c/Users/$USER
is mapped to ~
.
MSYS2
MSYS2 is a POSIX-like environment, consisting of a command-line shell and a minimal set of utilities. MSYS2 provides the msys-2.0.dll
library (a fork of cygwin1.dll
) to translate POSIX system calls to Windows kernel system calls. The goal of MSYS2 is to provide a POSIX-like environment for building software that targets Windows. MSYS2 includes a command-line package manager (pacman.exe
), and its package repository contains pre-built packages to support software development, including Git.
For programs that target MSYS2, Windows drives such as C:
are mapped to /c
, the MSYS2 installation directory is mapped to /
, and /c/Users/$USER
is mapped to ~
.
MSYS2 has 7 environments, unique combinations of development toolchain (GCC or LLVM), target architecture (i686
, x86_64
, or aarch64
) and C library (UCRT, MSVCRT, or Cygwin). The MSYSTEM
environment variable determines the MSYS2 environment. The default environment is MSYS
(GCC, x86_64
, and Cygwin), and can be used (after installing the actual development toolchain) to build software that targets MSYS2. The other 6 environments can be used to build software that targets Windows.
The MSYS2 package repository consists of 7 sub-repositories, one for each environment. The sub-repository for the MSYS
environment contains a development tools, headers, and libraries, as well as command-line shells, such as Bash and ZSH, and utilities, such as grep
, curl
, and vim
. The other sub-repositories only contain development tools, headers, and libraries. The development packages are provided by the MinGW-w64 project.
(The original MSYS was a package installed by the MinGW package manager, whereas MinGW-w64 packages are installed by the MSYS2 package manager.)
Git for Windows
Git for Windows is a port of Git that targets Windows. Git for Windows is built using MSYS2 and a development toolchain provided by the MinGW-w64 project. When you install Git for Windows you get some additional software that targets Windows, and some software that targets MSYS2 (most notably the Bash command-line shell). But since Git for Windows does not include the MSYS2 package manager, you cannot install additional software tht targets MSYS2.
Options
Here is a quick overview of the options for running Git on Windows:
- WSL: general purpose, full Linux distribution, all software targets Linux
- Cygwin: general purpose, many Linux packages including Git ported to target Cygwin
- MSYS2: for development purposes, some Linux packages including Git ported to target MSYS2
- Git for Windows: for using Git, some Linux packages ported to target MSYS2 or Windows, and some additional software that targets Windows
Summary
Software that targets Linux, such as Git, can run unmodified in WSL, or must be ported to target a custom POSIX environment such as Cygwin or MSYS2. The MSYS2 environment was designed specifically to be used to then build software that targets Windows. MSYS2 was used port Git to target Windows. The Git for Windows distribution contains this port, as well as a streamlined MSYS2 environment to run some additional utilities commonly used together with Git.
-
See Shell & Utilities in IEEE Std 1003.1-2017. ↩︎
-
Microsoft:
The UCRT also implements a large subset of the POSIX.1 (ISO/IEC 9945-1:1996, the POSIX System Application Program Interface) C library. However, it's not fully conformant to any specific POSIX standard.
↩︎ -
wsl.exe
runs the default distribution's default shell.wsl.exe command
runscommand
using the default distribution.debian.exe
runs Debian's default shell.debian.exe -c command
runscommand
using Debian.bash.exe
runs Bash using the default distribution. Also see A Guide to Invoking WSL. ↩︎