-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Building Git
We build Git for Windows using MSys2.
As we are in the process of switching away from msysGit as our development environment, the following instructions are a little rough on the edges. This situation should become better over the next months.
-
Install MSys2 from https://msys2.github.io/, into
C:/msys32
andC:/msys64
(if you only want to build for one architecture, you can skip the other one). This will install three Shells into the Start Menu: the MSys, the MinGW 32 and the MinGW 64 Shell. To build Git, you should start the MinGW shell corresponding to the architecture of the installed MSys2. -
Download setup-git-sdk.bat and put it in the the top-level MSys2 directory. Then run the
setup-git-sdk.bat
in acmd
window (you need to close all MSys2 windows before that, so that themsys-2.0.dll
file can be updated). Thesetup-git-sdk.bat
updates themsys2-runtime
and will install the git build dependencies viapacman
.
-
Open your corresponding MinGW Shell
-
Clone Git:
cd /usr/src/ && git clone https://github.com/git-for-windows/git
. -
Build Git:
make
. -
Run the test suite:
make test
Note: if you encounter messages like 39 [main] make 7628 child_info_fork::abort:...
while running make, follow the following MSYS2 Issue post, in short: close all MSys2 windows and run the autorebase.bat
script in the top-level MSys2 directory from a cmd
.
-
Start the MSys shell (i.e. not the MinGW 32-bit nor the MinGW 64-bit one).
-
Install the MSys2 Toolchain:
pacman -S gcc binutils make
. -
Clone the MSYS2-packages repository:
cd /usr/src && git clone https://github.com/git-for-windows/MSYS2-packages
. -
Build the package:
makepkg -s
.
(You might need to call pacman -S ca-certificates
to reinstall that package, it seems that it was not installed properly at least in one MSys2 32-bit setup.)
This is the Git for Windows wiki. See how-to-participate.