Package management in 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.
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)
I did not want to move from my already working Git for Windows installation so I improvised a bit:
- Install Git for Windows SDK somewhere else. You'll need more than 3 GB of free space for that.
- Copy
${git-sdk}/usr/bin/pacman.exe
to${git}/usr/bin
- Copy
${git-sdk}/etc/pacman.conf
and${git-sdk}/etc/pacman.d
to${git}/etc
- Copy
${git-sdk}/var
to${git}/
That's all. You can now open your Git Bash and run pacman -S python
to install packages on your existing Git for Windows setup.
You will need write access to Git for Windows directory. Also, your pacman
now thinks it has a lot of packages installed (from SDK) but it did not stop me from using it.