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_packages.bat debug
30 $ ./compat/vcbuild/vcpkg_copy_packages.bat release
32 3. Build git using MSVC from an SDK bash window using one of the
38 ================================================================
40 The Steps of Build Git with VS2008
42 1. You need the build environment, which contains the Git dependencies
43 to be able to compile, link and run Git with MSVC.
45 You can either use the binary repository:
47 WWW: http://repo.or.cz/w/msvcgit.git
48 Git: git clone git://repo.or.cz/msvcgit.git
49 Zip: http://repo.or.cz/w/msvcgit.git?a=snapshot;h=master;sf=zip
51 and call the setup_32bit_env.cmd batch script before compiling Git,
52 (see repo/package README for details), or the source repository:
54 WWW: http://repo.or.cz/w/gitbuild.git
55 Git: git clone git://repo.or.cz/gitbuild.git
56 Zip: (None, as it's a project with submodules)
58 and build the support libs as instructed in that repo/package.
60 2. Ensure you have the msysgit environment in your path, so you have
61 GNU Make, bash and perl available.
63 WWW: http://repo.or.cz/w/msysgit.git
64 Git: git clone git://repo.or.cz/msysgit.git
65 Zip: http://repo.or.cz/w/msysgit.git?a=snapshot;h=master;sf=zip
67 This environment is also needed when you use the resulting
68 executables, since Git might need to run scripts which are part of
71 3. Inside Git's directory run the command:
73 to generate the command-list.h file needed to compile git.
75 4. Then either build Git with the GNU Make Makefile in the Git projects
78 or generate Visual Studio solution/projects (.sln/.vcproj) with the
80 perl contrib/buildsystems/generate -g Vcproj
81 and open and build the solution with the IDE
82 devenv git.sln /useenv
83 or build with the IDE build engine directly from the command line
84 devenv git.sln /useenv /build "Release|Win32"
85 The /useenv option is required, so Visual Studio picks up the
86 environment variables for the support libraries required to build
87 Git, which you set up in step 1.