Package management in Git for Windows (Git Bash)?

I'm reading the github wiki for git-for-windows and it says that msys2 bundles pacman: https://github.com/git-for-windows/git/wiki/Package-management

But when I invoke it I get:

$ pacman
bash: pacman: command not found

Does anyone have an idea what is going on?

Which git version does this wiki refer to?

Is there a way to install additional packages to msys2 inside Git for windows?


As mentioned in issue 397:

This is intended. We do not ship pacman with Git for Windows.
If you are interested in a fully fledged package manager maintained environment you have to give the Git for Windows SDK a try.

The bash that you see in the latest git for Windows (2.5.3), which is a more recent bash than the old msysgit one, is only there to execute git commands.
It is not a full-fledged linux environment to install any third-party package.


Warning: dhj reports in the comments

Do not link your existing git for windows with the msys2 main system by using a directory junction.
If you uninstall it will decide that linked directory belongs to it and DELETE YOUR ENTIRE HOME DIRECTORY including sub-directories like "Downloads".
Beware dealing with msys2.

I don't know if the same is true for the git for windows SDK, but BE CAREFUL trying to get pacman from other systems integrated with git for windows.


Git for Windows (https://gitforwindows.org/ or https://git-scm.com/downloads) has Git Bash but it does not include tree.

tree is available via pacman (Package Manager), but that is only available if you install "Git for Windows SDK" (scroll to the bottom of https://gitforwindows.org/ which provides a link to download installer for it from https://github.com/git-for-windows/build-extra/releases/latest)

The accepted answer was very helpful. They mention that git-for-windows was not meant to include pacman in the default install.

So I installed "Git for Windows SDK", then in its bash prompt (SDK-64) I ran the following to install current tree v1.7.0-1 (as of this posting Aug 30, 2018):

[SDK-64: Bash Terminal for Git for Windows SDK]
pacman -S tree
...
Proceed with installation? [Y/n] Y

On my system, Git for Windows SDK is installed under: C:\git-sdk-64, so from my Git for Windows Bash shell (which did not have tree installed), I copied it over tree.exe to its /usr/bin directory, e.g.

[MINGW64: Bash Terminal for Git for Windows]
cd /usr/bin
cp /c/git-sdk-64/usr/bin/tree.exe .

Now I can run tree v1.7.0 from both Git Bash shells.

To make it even easier for others and maybe myself on a future machine, I looked at where pacman was getting the tree package from by running the following in my Git for Windows SDK Bash terminal:

$ pacman -S --info tree
Repository      : msys
Name            : tree
Version         : 1.7.0-1
Description     : A directory listing program displaying a depth indented list of files
Architecture    : x86_64
...

The key thing here is that pacman is getting tree from the "msys" repository (FYI: even though it says msys, it really is using msys2), so I looked at /etc/pacman.d/mirrorlist.msys and the first mirror points to http://repo.msys2.org/msys/$arch/

So next time you want a package that is NOT in Git for Windows, you can download them from: http://repo.msys2.org/msys/x86_64/ (for 64-bit) or from http://repo.msys2.org/msys/i686/ (32-bit)

e.g. direct download link for tree v1.7.0-1

  • 64-bit: http://repo.msys2.org/msys/x86_64/tree-1.7.0-1-x86_64.pkg.tar.xz
  • or https://sourceforge.net/projects/msys2/files/REPOS/MSYS2/x86_64/tree-1.7.0-1-x86_64.pkg.tar.xz
  • 32-bit: http://repo.msys2.org/msys/i686/tree-1.7.0-1-i686.pkg.tar.xz
  • or https://sourceforge.net/projects/msys2/files/REPOS/MSYS2/i686/tree-1.7.0-1-i686.pkg.tar.xz

FYI: Git SCM's Window's download at https://git-scm.com/download/ pulls the latest from Git for Windows GitHub (https://github.com/git-for-windows/git from the https://github.com/git-for-windows/git/releases/ link)