How to call MSYS2's git.exe from a Windows program or IDE?
06:55 21 Mar 2026

Problem

I have MSYS2 installed and want to use its git.exe (C:\msys64\usr\bin\git.exe) as the Git backend for a Windows tool (e.g., an IDE, a build script, or a custom program that shells out to git).

However, MSYS2's git is a Cygwin-based binary that only understands Unix-style paths (e.g., /c/Users/foo). When a Windows program calls it with Windows-style paths (e.g., C:\Users\foo or --work-tree=D:\project), git either fails with an error or silently operates on the wrong path.

Symptoms include:

  • fatal: not a git repository even when the path is correct
  • ~/.gitconfig or ~/.ssh/ not being found (SSH key auth failures)
  • Git sub-commands that receive path arguments behaving incorrectly

What I tried:

  • Simply pointing the tool to C:\msys64\usr\bin\git.exe — fails due to path format
  • Adding C:\msys64\usr\bin to PATH — doesn't fix the path format mismatch
  • Using Git for Windows separately — works, but I specifically want MSYS2's git (e.g., to keep it in sync with other MSYS2 packages via pacman)

Environment

  • Windows 10/11
  • MSYS2 installed at C:\msys64
  • MSYS2 git installed via pacman -S git
  • The calling program passes Windows absolute paths as arguments

Question

How can I transparently wrap MSYS2's git.exe so that any Windows program can call it with Windows-style paths and have them automatically converted to MSYS2 Unix-style paths?

windows git msys2