Skip to content

Instantly share code, notes, and snippets.

@AndreSteenveld
Created April 20, 2021 21:08
Show Gist options
  • Save AndreSteenveld/cb6662c93c8323795c5fd347defb8976 to your computer and use it in GitHub Desktop.
Save AndreSteenveld/cb6662c93c8323795c5fd347defb8976 to your computer and use it in GitHub Desktop.
Installing pacman on git for windows

Why?

I recently made a fresh install of windows and all the tools I needed to develop software including git-for-windows. Unfortunatnly git-for-windows doesn't come with a packagemanager buildt in and going full cygwin seems a little overkill. After some research I ran in to this post on stackoverflow describing a way to install pacman in to git-for-windows. Unfortuntly only "most of it" worked in my case. This document attempts to describe the entire process I went through to install pacman.

Prepare

The packages in the MSYS2 repositoy seem to be packaged using zstd now and not xz as described. Obviously it would be great to use a package manager to install zstd and un-tar the files... Given that this guide is geared towards windows installs you can install 7zip and add the Modern7z plugins to unpack zstd files.

Downloading and unpacking the neccesary packages

Download the following packages from the MSYS2 repository: pacman, pacman-mirrors, msys2-keyring. In your ~/Downloads directory unpack the files to just the tar files and open a bash terminal as administrator.

# In your elevated terminal we're going to unpack the files
cd /
tar x -vf ~/Downloads/msys2-keyring-1~20201002-1-any.pkg.tar usr
tar x -vf ~/Downloads/pacman-mirrors-20201028-1-any.pkg.tar etc
tar x -vf ~/Downloads/pacman-5.2.2-4-x86_64.pkg.tar usr

Create a config file and update

After unpacking pacman we can touch a configuration file and setup the keyrings, for good measure I took the config file from the git-sdk:

# Grab a fresh config file
curl --location https://github.com/git-for-windows/git-sdk-64/blob/main/etc/pacman.conf > /etc/pacman.conf

# Add the git-for-windows-keyring and locally sign
curl --location https://raw.githubusercontent.com/git-for-windows/build-extra/master/git-for-windows-keyring/git-for-windows.gpg | pacman-key --add - && pacman-key --lsign-key 1A9F3986

Sources

@MagicJack
Copy link

the url for /etc/pacman.conf is incorrect. it should be:

https://raw.githubusercontent.com/git-for-windows/git-sdk-64/main/etc/pacman.conf

@PStoner3
Copy link

FYI, the link to "Setting up windows with msys2" is dead

@piotrkundu
Copy link

If you get stuck, then just ping me. I made this guide for setting up MSYS2 from scratch and then add mingw64 version of git (which is native and not using POSIX emulation layer) : https://gist.github.com/piotrkundu/e7d94204dd3c48525b23c59fe5d23478

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment