Skip to content

Instantly share code, notes, and snippets.

@adojos
Last active August 19, 2025 14:56
Show Gist options
  • Save adojos/0abab00dd7e6bd84db39a760fb40a340 to your computer and use it in GitHub Desktop.
Save adojos/0abab00dd7e6bd84db39a760fb40a340 to your computer and use it in GitHub Desktop.
Git: Pacman Installation on Git For Windows #git

Git For Windows (GitBash) Pacman Installation

The 'Git for Windows' by default does not come with MSYS2 package manager called 'Pacman' and hence it is a limited version or subset of the MSYS2. Also the bash which supplied wih 'Git for Windows' is not a full version of bash hence does not provide for full Linux environment.

However you can get package manager support inside 'Git for Windows' in following ways :

  1. Install full MSYS2 and build Git for Windows yourself (Most git users don't require all packages and MSYS2)
  2. Install Git for Windows SDK (heavy & consumes around 3-5 Gb space)
  3. Use a hack to merge the MSYS2 Pacman packages with your existing Git for Windows installation

Alternative to Full Install: If you are installing MSYS2 or the Git WindowsSDK then best to use installer. However if you dont want to go for full install then you can try an alternative of obtaining the zipped package here - http://repo.msys2.org/msys/x86_64/  

Given below is the easiest method (bullet 3 above) to enable package manager (Pacman) support for an existing Git for Windows installation.


Merge MSYS2 Pacman Packages with Git for Windows installation

  1. Install Git for Windows SDK (Require approx 4 GB) or check 'Alternative to Full Install' above.
  2. Copy ${git-sdk}/usr/bin/pacman.exe to ${git}/usr/bin
  3. Copy ${git-sdk}/etc/pacman.conf to ${git}/etc
  4. Copy ${git-sdk}/etc/pacman.d to ${git}/etc
  5. Copy ${git-sdk}/var to ${git}/

DONE!!! Now you can use Pacman to install new packages from the MSYS2 Repository.


@avbentem
Copy link

Git for Windows doesn't have full zstd preinstalled, so, tar --zstd will not work. Simplest solution what I was able to make is

#!/bin/bash
...

The above worked nicely! One thing: I had to run Git Bash as administrator, for otherwise the copy command would throw an access denied. I do not see any difference in the output of whoami or id when running Git Bash as administrator or not. But alas, when running without admin rights I indeed could not create /var myself either. So, running as administrator helped.

Thanks, @smaug2309, finally zsh, whois and nc on Windows. (And dig and host, but not through Pacman.)

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