What's the difference between git-for-windows's git and msys2's git?

1,797 views
Skip to first unread message

Youda00008

unread,
Mar 3, 2018, 11:00:34 AM3/3/18
to git-for-windows
Now i'm totaly confused. I have been using Msys2 for some time and now i need to install git. But i see there are multiple options and i can't decide which one to use.
  • Install package msys/git inside Msys environment of my current Msys2 installation
  • Install package mingw64/mingw-w64-x86_64-git inside MinGW64 environment of my current Msys2 installation
  • Install package git-for-windows/mingw-w64-x86_64-git inside MinGW64 environment of my current Msys2 installation after adding GfW repositories
  • Install Git-for-Windows, which as i read is some custom version of Msys2 with the needed packages already preinstalled

I already understand, that the msys/git is an app built for Unix-like systems and using an emulation layer to make it work on Windows, which means it's slower.

But i have no idea, what's the difference between the following 3 and which one is best for my needs. Can someone please explain?

Johannes Schindelin

unread,
Mar 5, 2018, 10:12:49 AM3/5/18
to Youda00008, git-for-windows
Hi,

On Thu, 1 Mar 2018, Youda00008 wrote:

> Now i'm totaly confused. I have been using Msys2 for some time and now i
> need to install git. But i see there are multiple options and i can't
> decide which one to use.
>
> - Install package msys/git inside Msys environment of my current Msys2
> installation

The first thing you need to understand when using MSYS2 is that there are
MSYS packages (which use the POSIX emulation layer provided by the MSYS2
runtime, derived from Cygwin), and MINGW packages (which do not allow
using POSIX functionality other than what is provided by the Win32 API,
but allow full access to the Win32 API instead).

I figured out that by msys/git you referred to the `msys` Pacman
repository's `git` package. This one uses that MSYS2 runtime layer, so it
provides all the POSIX emulation and is therefore very faithful with
regards to Linux Git's functionality, but also very slow.

> - Install package mingw64/mingw-w64-x86_64-git inside MinGW64
> environment of my current Msys2 installation
> - Install package git-for-windows/mingw-w64-x86_64-git inside MinGW64
> environment of my current Msys2 installation after adding GfW repositories

These two are MINGW packages, and almost identical. The main difference is
that the latter comes from Git for Windows' Pacman repository, and has
executables code-signed by me.

Regular MSYS2 installations only access the `msys` and the
`mingw64`/`mingw32` Pacman repositories.

As MINGW packages, they rely heavily on the "mini compatibility layer"
provided by compat/mingw*, compat/winansi* and compat/win32/*. This means
that the code is faster, but also that it does not emulate, say, the POSIX
permission system (which has only user/group/world permissions, a far cry
from Windows' sophisticated ACLs), as well as many other things where
Linux has no Windows equivalent.

> - Install Git-for-Windows, which as i read is some custom version of
> Msys2 with the needed packages already preinstalled

Yes, Git for Windows installs a subset of MSYS2 with Git for Windows'
`mingw-w64-git` package installed. There are a couple more customizations
performed by the post-install script of the `git-extra` package, because
MSYS2's defaults to not work well for Git out of the box.

Ciao,
Johannes

Youda00008

unread,
Mar 5, 2018, 10:34:51 AM3/5/18
to git-for-windows
Thank you for your answer.

Can i ask one more thing?


Yes, Git for Windows installs a subset of MSYS2 with Git for Windows'
`mingw-w64-git` package installed. There are a couple more customizations
performed by the post-install script of the `git-extra` package, because
MSYS2's defaults to not work well for Git out of the box.

Why does Msys2 not work well for Git? Can you give me some examples of what issues can raise if i use git from mingw64 repository?
Also what exactly does the git-extra package. Can you list some of the most important changes to the Msys2 environment?

Johannes Schindelin

unread,
Apr 28, 2018, 8:15:34 AM4/28/18
to Youda00008, git-for-windows
Hi,

On Mon, 5 Mar 2018, Youda00008 wrote:

> Can i ask one more thing?

You just did.

> > Yes, Git for Windows installs a subset of MSYS2 with Git for Windows'
> > `mingw-w64-git` package installed. There are a couple more
> > customizations performed by the post-install script of the `git-extra`
> > package, because MSYS2's defaults to not work well for Git out of the
> > box.
>
> Why does Msys2 not work well for Git?

It works well. But it is slow, due to the need to emulate POSIX features
not present on Windows.

> Can you give me some examples of what issues can raise if i use git from
> mingw64 repository?

The most obvious issue of MINGW Git that MSYS2 Git does not have and that
comes to my mind is: MINGW Git follows Windows' rules as to file names. So
you cannot embed quotes in file names, for example.

> Also what exactly does the git-extra package. Can you list some of the most
> important changes to the Msys2 environment?

The git-extra package provides a couple of helpers (such as
`git-update-git-for-windows`) and also modifies a couple of configuration
files provided by MSYS2 where no official way exists to override MSYS2
defaults (which are sometimes quite unfortunate). For example, we want the
home directory to be set via the environment variable HOME, not by asking
the domain controller.

There are plenty more changes; I invite you to study the source code to
answer more of your questions:

https://github.com/git-for-windows/build-extra/blob/master/git-extra/git-extra.install.in

https://github.com/git-for-windows/build-extra/commits/master/git-extra/git-extra.install.in

Ciao,
Johannes
Message has been deleted

Youda00008

unread,
May 2, 2018, 2:07:58 PM5/2/18
to git-for-windows

> > Yes, Git for Windows installs a subset of MSYS2 with Git for Windows'
> > `mingw-w64-git` package installed. There are a couple more
> > customizations performed by the post-install script of the `git-extra`
> > package, because MSYS2's defaults to not work well for Git out of the
> > box.
>
> Why does Msys2 not work well for Git?

It works well. But it is slow, due to the need to emulate POSIX features
not present on Windows.

> Can you give me some examples of what issues can raise if i use git from
> mingw64 repository?

The most obvious issue of MINGW Git that MSYS2 Git does not have and that
comes to my mind is: MINGW Git follows Windows' rules as to file names. So
you cannot embed quotes in file names, for example.

Well i meant rather why does the mingw64/mingw-w64-x86_64-git not work well (without git-extra etc). What if i just use this one instead of your git-for-windows/mingw-w64-x86_
64-git. Where will be the difference? What are the known issues that led you to create your custom packages?

Johannes Schindelin

unread,
May 2, 2018, 5:46:32 PM5/2/18
to Youda00008, git-for-windows
Hi,

On Wed, 2 May 2018, Youda00008 wrote:

> > > > Yes, Git for Windows installs a subset of MSYS2 with Git for
> > > > Windows' `mingw-w64-git` package installed. There are a couple
> > > > more customizations performed by the post-install script of the
> > > > `git-extra` package, because MSYS2's defaults to not work well for
> > > > Git out of the box.
> > >
> > > Why does Msys2 not work well for Git? Can you give me some examples
> > > of what issues can raise if i use git from mingw64 repository?
> >
> > The most obvious issue of MINGW Git that MSYS2 Git does not have and
> > that comes to my mind is: MINGW Git follows Windows' rules as to file
> > names. So you cannot embed quotes in file names, for example.
>
> Well i meant rather why does the mingw64/mingw-w64-x86_64-git not work well
> (without git-extra etc). What if i just use this one instead of your
> git-for-windows/mingw-w64-x86_64-git. Where will be the difference? What
> are the known issues that led you to create your custom packages?

The test suite will not pass without the custom MSYS2 runtime, but that is
not even the git-extra package. The git-extra package is mainly used to
adjust files provided by MSYS2 that do not have any other way to be
overridden, such as the change where we prefer the environment variable
HOME to specify the user directory, rather than using a directory relative
to the MSYS2 root (which would be located within C:\Program Files\Git in
and end user installation, i.e. not writable).

Why don't you study the post-install script of git-extra? There are a ton
of comments in there, as well as a commit history with commit messages
that explain a lot.

https://github.com/git-for-windows/build-extra/blob/master/git-extra/git-extra.install.in

Ciao,
Johannes
Reply all
Reply to author
Forward
0 new messages