1 The Steps to Build Git with VS2015 or VS2017 from the command line.
3 1. Install the "vcpkg" open source package manager and build essential
4 third-party libraries. The steps for this have been captured in a
5 set of convenience scripts. These can be run from a stock Command
6 Prompt or from an SDK bash window:
9 $ ./compat/vcbuild/vcpkg_install.bat
11 The vcpkg tools and all of the third-party sources will be installed
13 <repo_root>/compat/vcbuild/vcpkg/
15 A file will be created with a set of Makefile macros pointing to a
16 unified "include", "lib", and "bin" directory (release and debug) for
17 all of the required packages. This file will be included by the main
19 <repo_root>/compat/vcbuild/MSVC-DEFS-GEN
21 2. OPTIONALLY copy the third-party *.dll and *.pdb files into the repo
22 root to make it easier to run and debug git.exe without having to
23 manipulate your PATH. This is especially true for debug sessions in
26 Use ONE of the following forms which should match how you want to
29 $ ./compat/vcbuild/vcpkg_copy_dlls.bat debug
30 $ ./compat/vcbuild/vcpkg_copy_dlls.bat release
32 3. Build git using MSVC from an SDK bash window using one of the
38 ================================================================
40 Alternatively, run `make vcxproj` and then load the generated `git.sln` in
41 Visual Studio. The initial build will install the vcpkg system and build the
42 dependencies automatically. This will take a while.
44 Instead of generating the `git.sln` file yourself (which requires a full Git
45 for Windows SDK), you may want to consider fetching the `vs/master` branch of
46 https://github.com/git-for-windows/git instead (which is updated automatically
47 via CI running `make vcxproj`). The `vs/master` branch does not require a Git
48 for Windows to build, but you can run the test scripts in a regular Git Bash.
50 Note that `make vcxproj` will automatically add and commit the generated `.sln`
51 and `.vcxproj` files to the repo. This is necessary to allow building a
52 fully-testable Git in Visual Studio, where a regular Git Bash can be used to
53 run the test scripts (as opposed to a full Git for Windows SDK): a number of
54 build targets, such as Git commands implemented as Unix shell scripts (where
55 `@@SHELL_PATH@@` and other placeholders are interpolated) require a full-blown
56 Git for Windows SDK (which is about 10x the size of a regular Git for Windows
59 If your plan is to open a Pull Request with Git for Windows, it is a good idea
60 to drop this commit before submitting.
62 ================================================================
63 The Steps of Build Git with VS2008
65 1. You need the build environment, which contains the Git dependencies
66 to be able to compile, link and run Git with MSVC.
68 You can either use the binary repository:
70 WWW: http://repo.or.cz/w/msvcgit.git
71 Git: git clone git://repo.or.cz/msvcgit.git
72 Zip: http://repo.or.cz/w/msvcgit.git?a=snapshot;h=master;sf=zip
74 and call the setup_32bit_env.cmd batch script before compiling Git,
75 (see repo/package README for details), or the source repository:
77 WWW: http://repo.or.cz/w/gitbuild.git
78 Git: git clone git://repo.or.cz/gitbuild.git
79 Zip: (None, as it's a project with submodules)
81 and build the support libs as instructed in that repo/package.
83 2. Ensure you have the msysgit environment in your path, so you have
84 GNU Make, bash and perl available.
86 WWW: http://repo.or.cz/w/msysgit.git
87 Git: git clone git://repo.or.cz/msysgit.git
88 Zip: http://repo.or.cz/w/msysgit.git?a=snapshot;h=master;sf=zip
90 This environment is also needed when you use the resulting
91 executables, since Git might need to run scripts which are part of
94 3. Inside Git's directory run the command:
95 make command-list.h config-list.h
96 to generate the header file needed to compile git.
98 4. Then either build Git with the GNU Make Makefile in the Git projects
101 or generate Visual Studio solution/projects (.sln/.vcproj) with the
103 perl contrib/buildsystems/generate -g Vcproj
104 and open and build the solution with the IDE
105 devenv git.sln /useenv
106 or build with the IDE build engine directly from the command line
107 devenv git.sln /useenv /build "Release|Win32"
108 The /useenv option is required, so Visual Studio picks up the
109 environment variables for the support libraries required to build
110 Git, which you set up in step 1.