Linus Torvalds | c538d2d | 2005-06-17 11:30:04 -0700 | [diff] [blame] | 1 | |
| 2 | Git installation |
| 3 | |
| 4 | Normally you can just do "make" followed by "make install", and that |
| 5 | will install the git programs in your own ~/bin/ directory. If you want |
| 6 | to do a global install, you can do |
| 7 | |
David Kastrup | 98e79f6 | 2007-08-07 12:02:12 +0200 | [diff] [blame] | 8 | $ make prefix=/usr all doc info ;# as yourself |
Michael J Gruber | 414851a | 2008-09-10 10:19:34 +0200 | [diff] [blame] | 9 | # make prefix=/usr install install-doc install-html install-info ;# as root |
Linus Torvalds | c538d2d | 2005-06-17 11:30:04 -0700 | [diff] [blame] | 10 | |
Junio C Hamano | c44922a | 2005-11-09 12:40:03 -0800 | [diff] [blame] | 11 | (or prefix=/usr/local, of course). Just like any program suite |
| 12 | that uses $prefix, the built results have some paths encoded, |
| 13 | which are derived from $prefix, so "make all; make prefix=/usr |
| 14 | install" would not work. |
Linus Torvalds | c538d2d | 2005-06-17 11:30:04 -0700 | [diff] [blame] | 15 | |
Brian Gernhardt | 5beb577 | 2009-09-10 16:28:19 -0400 | [diff] [blame] | 16 | The beginning of the Makefile documents many variables that affect the way |
| 17 | git is built. You can override them either from the command line, or in a |
| 18 | config.mak file. |
| 19 | |
Jakub Narebski | 5566771 | 2006-07-03 01:56:48 +0200 | [diff] [blame] | 20 | Alternatively you can use autoconf generated ./configure script to |
| 21 | set up install paths (via config.mak.autogen), so you can write instead |
| 22 | |
Jakub Narebski | 3900145 | 2006-08-08 18:35:23 +0200 | [diff] [blame] | 23 | $ make configure ;# as yourself |
Jakub Narebski | 5566771 | 2006-07-03 01:56:48 +0200 | [diff] [blame] | 24 | $ ./configure --prefix=/usr ;# as yourself |
| 25 | $ make all doc ;# as yourself |
Michael J Gruber | 414851a | 2008-09-10 10:19:34 +0200 | [diff] [blame] | 26 | # make install install-doc install-html;# as root |
Jakub Narebski | 5566771 | 2006-07-03 01:56:48 +0200 | [diff] [blame] | 27 | |
Andi Kleen | 3900100 | 2011-06-20 15:41:01 -0700 | [diff] [blame] | 28 | If you're willing to trade off (much) longer build time for a later |
| 29 | faster git you can also do a profile feedback build with |
| 30 | |
Andi Kleen | 066dd26 | 2014-07-07 23:35:11 -0700 | [diff] [blame] | 31 | $ make prefix=/usr profile |
Theodore Ts'o | f2d713f | 2012-02-06 01:00:17 -0500 | [diff] [blame] | 32 | # make prefix=/usr PROFILE=BUILD install |
Andi Kleen | 3900100 | 2011-06-20 15:41:01 -0700 | [diff] [blame] | 33 | |
| 34 | This will run the complete test suite as training workload and then |
| 35 | rebuild git with the generated profile feedback. This results in a git |
| 36 | which is a few percent faster on CPU intensive workloads. This |
| 37 | may be a good tradeoff for distribution packagers. |
| 38 | |
Andi Kleen | 066dd26 | 2014-07-07 23:35:11 -0700 | [diff] [blame] | 39 | Alternatively you can run profile feedback only with the git benchmark |
| 40 | suite. This runs significantly faster than the full test suite, but |
| 41 | has less coverage: |
| 42 | |
| 43 | $ make prefix=/usr profile-fast |
| 44 | # make prefix=/usr PROFILE=BUILD install |
| 45 | |
Theodore Ts'o | f2d713f | 2012-02-06 01:00:17 -0500 | [diff] [blame] | 46 | Or if you just want to install a profile-optimized version of git into |
| 47 | your home directory, you could run: |
| 48 | |
Andi Kleen | 066dd26 | 2014-07-07 23:35:11 -0700 | [diff] [blame] | 49 | $ make profile-install |
| 50 | |
| 51 | or |
| 52 | $ make profile-fast-install |
Theodore Ts'o | f2d713f | 2012-02-06 01:00:17 -0500 | [diff] [blame] | 53 | |
| 54 | As a caveat: a profile-optimized build takes a *lot* longer since the |
| 55 | git tree must be built twice, and in order for the profiling |
| 56 | measurements to work properly, ccache must be disabled and the test |
| 57 | suite has to be run using only a single CPU. In addition, the profile |
| 58 | feedback build stage currently generates a lot of additional compiler |
| 59 | warnings. |
Jakub Narebski | 5566771 | 2006-07-03 01:56:48 +0200 | [diff] [blame] | 60 | |
Linus Torvalds | c538d2d | 2005-06-17 11:30:04 -0700 | [diff] [blame] | 61 | Issues of note: |
| 62 | |
Junio C Hamano | a958d8e | 2008-07-06 19:10:00 -0700 | [diff] [blame] | 63 | - Ancient versions of GNU Interactive Tools (pre-4.9.2) installed a |
| 64 | program "git", whose name conflicts with this program. But with |
| 65 | version 4.9.2, after long hiatus without active maintenance (since |
| 66 | around 1997), it changed its name to gnuit and the name conflict is no |
| 67 | longer a problem. |
Linus Torvalds | c538d2d | 2005-06-17 11:30:04 -0700 | [diff] [blame] | 68 | |
Abhijit Menon-Sen | 25032cc | 2008-08-05 07:41:04 +0530 | [diff] [blame] | 69 | NOTE: When compiled with backward compatibility option, the GNU |
Junio C Hamano | a958d8e | 2008-07-06 19:10:00 -0700 | [diff] [blame] | 70 | Interactive Tools package still can install "git", but you can build it |
| 71 | with --disable-transition option to avoid this. |
Miklos Vajna | 62a64d1 | 2008-05-04 16:55:11 +0200 | [diff] [blame] | 72 | |
Matthew Ogilvie | 9045801 | 2009-12-02 22:14:07 -0700 | [diff] [blame] | 73 | - You can use git after building but without installing if you want |
| 74 | to test drive it. Simply run git found in bin-wrappers directory |
| 75 | in the build directory, or prepend that directory to your $PATH. |
| 76 | This however is less efficient than running an installed git, as |
| 77 | you always need an extra fork+exec to run any git subcommand. |
| 78 | |
| 79 | It is still possible to use git without installing by setting a few |
| 80 | environment variables, which was the way this was done |
| 81 | traditionally. But using git found in bin-wrappers directory in |
| 82 | the build directory is far simpler. As a historical reference, the |
| 83 | old way went like this: |
Junio C Hamano | 3c767a0 | 2006-07-02 23:54:47 -0700 | [diff] [blame] | 84 | |
| 85 | GIT_EXEC_PATH=`pwd` |
| 86 | PATH=`pwd`:$PATH |
Ævar Arnfjörð Bjarmason | 20d2a30 | 2017-12-10 21:13:33 +0000 | [diff] [blame] | 87 | GITPERLLIB=`pwd`/perl/build/lib |
Petr Baudis | 6fcca93 | 2006-07-03 23:16:32 +0200 | [diff] [blame] | 88 | export GIT_EXEC_PATH PATH GITPERLLIB |
Junio C Hamano | 3c767a0 | 2006-07-02 23:54:47 -0700 | [diff] [blame] | 89 | |
Ævar Arnfjörð Bjarmason | 20d2a30 | 2017-12-10 21:13:33 +0000 | [diff] [blame] | 90 | - By default (unless NO_PERL is provided) Git will ship various perl |
Ævar Arnfjörð Bjarmason | 1aca69c | 2018-03-03 15:38:17 +0000 | [diff] [blame] | 91 | scripts. However, for simplicity it doesn't use the |
| 92 | ExtUtils::MakeMaker toolchain to decide where to place the perl |
| 93 | libraries. Depending on the system this can result in the perl |
Ævar Arnfjörð Bjarmason | 20d2a30 | 2017-12-10 21:13:33 +0000 | [diff] [blame] | 94 | libraries not being where you'd like them if they're expected to be |
| 95 | used by things other than Git itself. |
| 96 | |
| 97 | Manually supplying a perllibdir prefix should fix this, if this is |
| 98 | a problem you care about, e.g.: |
| 99 | |
| 100 | prefix=/usr perllibdir=/usr/$(/usr/bin/perl -MConfig -wle 'print substr $Config{installsitelib}, 1 + length $Config{siteprefixexp}') |
| 101 | |
| 102 | Will result in e.g. perllibdir=/usr/share/perl/5.26.1 on Debian, |
| 103 | perllibdir=/usr/share/perl5 (which we'd use by default) on CentOS. |
| 104 | |
Ævar Arnfjörð Bjarmason | 1aca69c | 2018-03-03 15:38:17 +0000 | [diff] [blame] | 105 | - Unless NO_PERL is provided Git will ship various perl libraries it |
| 106 | needs. Distributors of Git will usually want to set |
| 107 | NO_PERL_CPAN_FALLBACKS if NO_PERL is not provided to use their own |
| 108 | copies of the CPAN modules Git needs. |
| 109 | |
Linus Torvalds | c538d2d | 2005-06-17 11:30:04 -0700 | [diff] [blame] | 110 | - Git is reasonably self-sufficient, but does depend on a few external |
Brian Gernhardt | 5beb577 | 2009-09-10 16:28:19 -0400 | [diff] [blame] | 111 | programs and libraries. Git can be used without most of them by adding |
Elijah Newren | 8915297 | 2019-11-05 17:07:21 +0000 | [diff] [blame] | 112 | the appropriate "NO_<LIBRARY>=YesPlease" to the make command line or |
Brian Gernhardt | 5beb577 | 2009-09-10 16:28:19 -0400 | [diff] [blame] | 113 | config.mak file. |
Linus Torvalds | c538d2d | 2005-06-17 11:30:04 -0700 | [diff] [blame] | 114 | |
| 115 | - "zlib", the compression library. Git won't build without it. |
| 116 | |
Brian Gernhardt | 26d9443 | 2009-09-08 21:51:00 -0400 | [diff] [blame] | 117 | - "ssh" is used to push and pull over the net. |
| 118 | |
Andrei Rybak | 932757b | 2019-11-14 18:33:16 +0100 | [diff] [blame] | 119 | - A POSIX-compliant shell is required to run some scripts needed |
| 120 | for everyday use (e.g. "bisect", "request-pull"). |
Brian Gernhardt | 26d9443 | 2009-09-08 21:51:00 -0400 | [diff] [blame] | 121 | |
Todd Zullinger | d13a73e | 2023-11-16 14:30:10 -0500 | [diff] [blame] | 122 | - "Perl" version 5.8.1 or later is needed to use some of the |
Ævar Arnfjörð Bjarmason | 20b813d | 2023-02-06 23:58:56 +0100 | [diff] [blame] | 123 | features (e.g. sending patches using "git send-email", |
Ævar Arnfjörð Bjarmason | d48b284 | 2010-09-24 20:00:52 +0000 | [diff] [blame] | 124 | interacting with svn repositories with "git svn"). If you can |
Junio C Hamano | 634a5f2 | 2012-01-26 21:48:33 -0800 | [diff] [blame] | 125 | live without these, use NO_PERL. Note that recent releases of |
| 126 | Redhat/Fedora are reported to ship Perl binary package with some |
Josh Soref | d05b08c | 2023-11-24 03:35:13 +0000 | [diff] [blame] | 127 | core modules stripped away (see https://lwn.net/Articles/477234/), |
Junio C Hamano | 634a5f2 | 2012-01-26 21:48:33 -0800 | [diff] [blame] | 128 | so you might need to install additional packages other than Perl |
Todd Zullinger | 14f437f | 2018-03-16 18:07:48 -0400 | [diff] [blame] | 129 | itself, e.g. Digest::MD5, File::Spec, File::Temp, Net::Domain, |
| 130 | Net::SMTP, and Time::HiRes. |
Brian Gernhardt | 26d9443 | 2009-09-08 21:51:00 -0400 | [diff] [blame] | 131 | |
Bernhard Reiter | 1e16b25 | 2014-11-09 15:55:53 +0100 | [diff] [blame] | 132 | - git-imap-send needs the OpenSSL library to talk IMAP over SSL if |
| 133 | you are using libcurl older than 7.34.0. Otherwise you can use |
| 134 | NO_OPENSSL without losing git-imap-send. |
Linus Torvalds | c538d2d | 2005-06-17 11:30:04 -0700 | [diff] [blame] | 135 | |
Ævar Arnfjörð Bjarmason | e54e502 | 2021-09-11 11:34:16 +0200 | [diff] [blame] | 136 | - "libcurl" library is used for fetching and pushing |
| 137 | repositories over http:// or https://, as well as by |
| 138 | git-imap-send if the curl version is >= 7.34.0. If you do |
| 139 | not need that functionality, use NO_CURL to build without |
| 140 | it. |
Linus Torvalds | c538d2d | 2005-06-17 11:30:04 -0700 | [diff] [blame] | 141 | |
Jeff King | ea61df9 | 2024-04-02 16:06:00 -0400 | [diff] [blame] | 142 | Git requires version "7.21.3" or later of "libcurl" to build |
Ævar Arnfjörð Bjarmason | 59a399e | 2021-09-13 16:51:23 +0200 | [diff] [blame] | 143 | without NO_CURL. This version requirement may be bumped in |
| 144 | the future. |
| 145 | |
Brian Gernhardt | 5beb577 | 2009-09-10 16:28:19 -0400 | [diff] [blame] | 146 | - "expat" library; git-http-push uses it for remote lock |
| 147 | management over DAV. Similar to "curl" above, this is optional |
| 148 | (with NO_EXPAT). |
Junio C Hamano | 3402f1d | 2005-11-05 11:12:05 -0800 | [diff] [blame] | 149 | |
Brian Gernhardt | 5beb577 | 2009-09-10 16:28:19 -0400 | [diff] [blame] | 150 | - "wish", the Tcl/Tk windowing shell is used in gitk to show the |
| 151 | history graphically, and in git-gui. If you don't want gitk or |
| 152 | git-gui, you can use NO_TCLTK. |
Horst von Brand | 663a5ed | 2005-09-11 20:00:49 -0400 | [diff] [blame] | 153 | |
Ævar Arnfjörð Bjarmason | 5e9637c | 2011-11-18 00:14:42 +0100 | [diff] [blame] | 154 | - A gettext library is used by default for localizing Git. The |
| 155 | primary target is GNU libintl, but the Solaris gettext |
| 156 | implementation also works. |
| 157 | |
| 158 | We need a gettext.h on the system for C code, gettext.sh (or |
| 159 | Solaris gettext(1)) for shell scripts, and libintl-perl for Perl |
| 160 | programs. |
| 161 | |
| 162 | Set NO_GETTEXT to disable localization support and make Git only |
| 163 | use English. Under autoconf the configure script will do this |
| 164 | automatically if it can't find libintl on the system. |
| 165 | |
Đoàn Trần Công Danh | fcedbc1 | 2020-12-10 21:30:17 +0700 | [diff] [blame] | 166 | - Python version 2.7 or later is needed to use the git-p4 interface |
Junio C Hamano | 2e4f04f | 2013-01-30 11:17:59 -0800 | [diff] [blame] | 167 | to Perforce. |
Pete Wyckoff | b6f9305 | 2012-04-08 20:18:00 -0400 | [diff] [blame] | 168 | |
Junio C Hamano | 3cab359 | 2005-11-11 11:27:03 -0800 | [diff] [blame] | 169 | - Some platform specific issues are dealt with Makefile rules, |
| 170 | but depending on your specific installation, you may not |
| 171 | have all the libraries/tools needed, or you may have |
| 172 | necessary libraries at unusual locations. Please look at the |
| 173 | top of the Makefile to see what can be adjusted for your needs. |
Jason Riedy | cd8c458 | 2005-12-05 10:38:30 -0800 | [diff] [blame] | 174 | You can place local settings in config.mak and the Makefile |
| 175 | will include them. Note that config.mak is not distributed; |
| 176 | the name is reserved for local settings. |
J. Bruce Fields | eff351c | 2006-01-21 18:54:12 -0500 | [diff] [blame] | 177 | |
Junio C Hamano | a90918e | 2007-06-18 01:43:34 -0700 | [diff] [blame] | 178 | - To build and install documentation suite, you need to have |
| 179 | the asciidoc/xmlto toolchain. Because not many people are |
| 180 | inclined to install the tools, the default build target |
David Kastrup | 98e79f6 | 2007-08-07 12:02:12 +0200 | [diff] [blame] | 181 | ("make all") does _not_ build them. |
| 182 | |
Michael J Gruber | 414851a | 2008-09-10 10:19:34 +0200 | [diff] [blame] | 183 | "make doc" builds documentation in man and html formats; there are |
| 184 | also "make man", "make html" and "make info". Note that "make html" |
| 185 | requires asciidoc, but not xmlto. "make man" (and thus make doc) |
| 186 | requires both. |
| 187 | |
| 188 | "make install-doc" installs documentation in man format only; there |
| 189 | are also "make install-man", "make install-html" and "make |
| 190 | install-info". |
| 191 | |
David Kastrup | 98e79f6 | 2007-08-07 12:02:12 +0200 | [diff] [blame] | 192 | Building and installing the info file additionally requires |
| 193 | makeinfo and docbook2X. Version 0.8.3 is known to work. |
| 194 | |
Miklos Vajna | a325a1a | 2008-12-10 23:44:50 +0100 | [diff] [blame] | 195 | Building and installing the pdf file additionally requires |
Jeff King | b2478aa | 2012-05-30 06:18:29 -0400 | [diff] [blame] | 196 | dblatex. Version >= 0.2.7 is known to work. |
Miklos Vajna | a325a1a | 2008-12-10 23:44:50 +0100 | [diff] [blame] | 197 | |
Bagas Sanjaya | 6534d43 | 2021-03-19 18:00:45 +0700 | [diff] [blame] | 198 | All formats require at least asciidoc 8.4.1. Alternatively, you can |
| 199 | use Asciidoctor (requires Ruby) by passing USE_ASCIIDOCTOR=YesPlease |
| 200 | to make. You need at least Asciidoctor version 1.5. |
Junio C Hamano | a90918e | 2007-06-18 01:43:34 -0700 | [diff] [blame] | 201 | |
Markus Heidelberg | b1a46b7 | 2008-11-02 18:53:03 +0100 | [diff] [blame] | 202 | There are also "make quick-install-doc", "make quick-install-man" |
| 203 | and "make quick-install-html" which install preformatted man pages |
Junio C Hamano | fcbebfd | 2011-11-08 10:17:40 -0800 | [diff] [blame] | 204 | and html documentation. To use these build targets, you need to |
| 205 | clone two separate git-htmldocs and git-manpages repositories next |
| 206 | to the clone of git itself. |
Michael J Gruber | 6fe570d | 2008-09-09 22:44:17 +0200 | [diff] [blame] | 207 | |
Martin Ågren | 5a80d85 | 2020-03-29 15:18:10 +0200 | [diff] [blame] | 208 | The minimum supported version of docbook-xsl is 1.74. |
Jon Seymour | 0edf06d | 2010-07-25 13:57:35 +1000 | [diff] [blame] | 209 | |
| 210 | Users attempting to build the documentation on Cygwin may need to ensure |
| 211 | that the /etc/xml/catalog file looks something like this: |
| 212 | |
| 213 | <?xml version="1.0"?> |
| 214 | <!DOCTYPE catalog PUBLIC |
| 215 | "-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN" |
| 216 | "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd" |
| 217 | > |
| 218 | <catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog"> |
| 219 | <rewriteURI |
| 220 | uriStartString = "http://docbook.sourceforge.net/release/xsl/current" |
| 221 | rewritePrefix = "/usr/share/sgml/docbook/xsl-stylesheets" |
| 222 | /> |
| 223 | <rewriteURI |
| 224 | uriStartString="http://www.oasis-open.org/docbook/xml/4.5" |
| 225 | rewritePrefix="/usr/share/sgml/docbook/xml-dtd-4.5" |
| 226 | /> |
| 227 | </catalog> |
| 228 | |
| 229 | This can be achieved with the following two xmlcatalog commands: |
| 230 | |
| 231 | xmlcatalog --noout \ |
| 232 | --add rewriteURI \ |
| 233 | http://docbook.sourceforge.net/release/xsl/current \ |
| 234 | /usr/share/sgml/docbook/xsl-stylesheets \ |
| 235 | /etc/xml/catalog |
| 236 | |
| 237 | xmlcatalog --noout \ |
| 238 | --add rewriteURI \ |
| 239 | http://www.oasis-open.org/docbook/xml/4.5/xsl/current \ |
| 240 | /usr/share/sgml/docbook/xml-dtd-4.5 \ |
| 241 | /etc/xml/catalog |