-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGit-Book_13.html
507 lines (351 loc) · 16.2 KB
/
Git-Book_13.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
<!DOCTYPE html><html lang="en"><head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="Asciidoctor 2.0.16">
<meta name="author" content="Valentin Haenel, Julius Plenz">
<title>Git Book — Appendix A: Installation</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:300,300italic,400,400italic,600,600italic%7CNoto+Serif:400,400italic,700,700italic%7CDroid+Sans+Mono:400,700">
<link rel="stylesheet" href="style0.css" type="text/css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="style1.css" type="text/css">
<link rel="stylesheet" href="asciidoctor-chunker.css" type="text/css"></head>
<body class="book toc2 toc-left">
<div id="header">
<h1>Git: Distributed Version Control for Code and Documents</h1>
<div class="details">
<span id="author" class="author">Valentin Haenel</span><br>
<span id="author2" class="author">Julius Plenz</span><br>
<span id="revnumber">version 3.0</span>
<br><span id="revremark">Beta Preview</span>
</div>
<div id="toc" class="toc2">
<div id="toctitle">Table of Contents</div>
<ul class="sectlevel1">
<li><a href="index.html">Title Page</a></li><li><a href="Git-Book_1.html">Preface</a>
<ul class="sectlevel2">
<li><a href="Git-Book_1.html#sec.reader">Who Is This Book Intended For?</a></li>
<li><a href="Git-Book_1.html#sec.structure">How to Read the Book?</a></li>
<li><a href="Git-Book_1.html#sec.conventions">Conventions</a></li>
<li><a href="Git-Book_1.html#sec.install-git-repo">Installation and “The Git-Repository”</a></li>
<li><a href="Git-Book_1.html#sec.docs">Documentation and Help</a></li>
<li><a href="Git-Book_1.html#sec.contact">Downloads and Contacts</a></li>
<li><a href="Git-Book_1.html#sec.acknowledgements">Acknowledgements</a></li>
<li><a href="Git-Book_1.html#sec.preface-2nd-edition">Preface to the 2nd Edition</a></li>
<li><a href="Git-Book_1.html#sec.preface-cc-edition">Preface to the Creative Commons Edition</a></li>
</ul>
</li>
<li><a href="Git-Book_2.html">1. Introduction and First Steps</a>
<ul class="sectlevel2">
<li><a href="Git-Book_2.html#sec.terminology">1.1. Basic Terminology</a></li>
<li><a href="Git-Book_2.html#sec.first-steps">1.2. First Steps with Git</a></li>
<li><a href="Git-Book_2.html#chap.git-config">1.3. Configuring Git</a></li>
</ul>
</li>
<li><a href="Git-Book_3.html">2. The Basics</a>
<ul class="sectlevel2">
<li><a href="Git-Book_3.html#sec.basics">2.1. Git Commands</a></li>
<li><a href="Git-Book_3.html#sec.object-model">2.2. The Object Model</a></li>
</ul>
</li>
<li><a href="Git-Book_4.html">3. Practical Version Control</a>
<ul class="sectlevel2">
<li><a href="Git-Book_4.html#sec.branches">3.1. References: Branches and Tags</a></li>
<li><a href="Git-Book_4.html#sec.undo">3.2. Restoring Versions</a></li>
<li><a href="Git-Book_4.html#sec.merge">3.3. Merging Branches</a></li>
<li><a href="Git-Book_4.html#sec.merge-conflicts">3.4. Resolving Merge Conflicts</a></li>
<li><a href="Git-Book_4.html#sec.cherry-pick">3.5. Taking over Individual Commits: Cherry Picking</a></li>
<li><a href="Git-Book_4.html#sec.visualization">3.6. Visualizing Repositories</a></li>
<li><a href="Git-Book_4.html#sec.reflog">3.7. Reflog</a></li>
</ul>
</li>
<li><a href="Git-Book_5.html">4. Advanced Concepts</a>
<ul class="sectlevel2">
<li><a href="Git-Book_5.html#sec.rebase">4.1. Moving commits — Rebase</a></li>
<li><a href="Git-Book_5.html#sec.rebase-i">4.2. Rewriting History — Interactive Rebase</a></li>
<li><a href="Git-Book_5.html#sec.blame">4.3. Who Made These Changes? — Git Blame</a></li>
<li><a href="Git-Book_5.html#sec.ignore">4.4. Ignoring Files</a></li>
<li><a href="Git-Book_5.html#sec.stash">4.5. Outsourcing Changes — Git Stash</a></li>
<li><a href="Git-Book_5.html#sec.notes">4.6. Annotating Commits — Git Notes</a></li>
<li><a href="Git-Book_5.html#sec.multi-root">4.7. Multiple Root Commits</a></li>
<li><a href="Git-Book_5.html#sec.bisect">4.8. Finding Regressions — Git Bisect</a></li>
</ul>
</li>
<li><a href="Git-Book_6.html">5. Distributed Git</a>
<ul class="sectlevel2">
<li><a href="Git-Book_6.html#sec.distributed-systems">5.1. How Does Distributed Version Control Work?</a></li>
<li><a href="Git-Book_6.html#sec.clone">5.2. Cloning Repositories</a></li>
<li><a href="Git-Book_6.html#sec.downloading-commits">5.3. Downloading Commits</a></li>
<li><a href="Git-Book_6.html#sec.uploading-commits">5.4. Uploading Commits: git push</a></li>
<li><a href="Git-Book_6.html#sec.remotes-check">5.5. Examining Remotes</a></li>
<li><a href="Git-Book_6.html#sec.multi-remote">5.6. Distributed Workflow with Multiple Remotes</a></li>
<li><a href="Git-Book_6.html#sec.managing-remotes">5.7. Managing Remotes</a></li>
<li><a href="Git-Book_6.html#sec.remote-tags">5.8. Exchanging Tags</a></li>
<li><a href="Git-Book_6.html#sec.patch-queue">5.9. Patches via E-mail</a></li>
<li><a href="Git-Book_6.html#sec.dictator">5.10. A Distributed, Hierarchical Workflow</a></li>
<li><a href="Git-Book_6.html#sec.subprojects">5.11. Managing Subprojects</a></li>
</ul>
</li>
<li><a href="Git-Book_7.html">6. Workflows</a>
<ul class="sectlevel2">
<li><a href="Git-Book_7.html#sec.workflows-user">6.1. User</a></li>
<li><a href="Git-Book_7.html#sec.branching-model">6.2. A Branching Model</a></li>
<li><a href="Git-Book_7.html#sec.releases-management">6.3. Release Management</a></li>
</ul>
</li>
<li><a href="Git-Book_8.html">7. Git Servers</a>
<ul class="sectlevel2">
<li><a href="Git-Book_8.html#sec.server">7.1. Hosting a Git Server</a></li>
<li><a href="Git-Book_8.html#sec.gitolite">7.2. Gitolite: Simple Git Hosting</a></li>
<li><a href="Git-Book_8.html#sec.git-daemon">7.3. Git Daemon: Anonymous Read-Only Access</a></li>
<li><a href="Git-Book_8.html#sec.gitweb">7.4. Gitweb: The Integrated Web Frontend</a></li>
<li><a href="Git-Book_8.html#sec.cgit">7.5. CGit — CGI for Git</a></li>
</ul>
</li>
<li><a href="Git-Book_9.html">8. Git Automation</a>
<ul class="sectlevel2">
<li><a href="Git-Book_9.html#sec.attributes">8.1. Git Attributes — Treating Files Separately</a></li>
<li><a href="Git-Book_9.html#sec.hooks">8.2. Hooks</a></li>
<li><a href="Git-Book_9.html#sec.scripting">8.3. Writing Your Own Git Commands</a></li>
<li><a href="Git-Book_9.html#sec.filter-branch">8.4. Rewriting Version History</a></li>
</ul>
</li>
<li><a href="Git-Book_10.html">9. Interacting with Other Version Control Systems</a>
<ul class="sectlevel2">
<li><a href="Git-Book_10.html#sec.subversion">9.1. Subversion</a></li>
<li><a href="Git-Book_10.html#sec.fast-import">9.2. Custom Importers</a></li>
</ul>
</li>
<li><a href="Git-Book_11.html">10. Shell Integration</a>
<ul class="sectlevel2">
<li><a href="Git-Book_11.html#sec.bash-integration">10.1. Git and the Bash</a></li>
<li><a href="Git-Book_11.html#sec.zsh-integration">10.2. Git and the Z-Shell</a></li>
</ul>
</li>
<li><a href="Git-Book_12.html">11. GitHub</a></li>
<li class="current"><a href="Git-Book_13.html">Appendix A: Installation</a>
<ul class="sectlevel2">
<li class="current"><a href="Git-Book_13.html#linux">A.1. Linux</a></li>
<li class="current"><a href="Git-Book_13.html#sec.osx">A.2. Mac OS X</a></li>
<li class="current"><a href="Git-Book_13.html#sec.windows">A.3. Windows</a></li>
</ul>
</li>
<li><a href="Git-Book_14.html">Appendix B: Repository Structure</a>
<ul class="sectlevel2">
<li><a href="Git-Book_14.html#sec.gc">B.1. Cleaning Up</a></li>
<li><a href="Git-Book_14.html#sec.gc-performance">B.2. Performance</a></li>
</ul>
</li>
</ul>
</div>
</div>
<div id="content"><div class="sect1">
<h2 id="app.installation"><a class="anchor" href="Git-Book_13.html"></a>Appendix A: Installation</h2>
<div class="sectionbody">
<div class="paragraph">
<p>Installing Git is easy and fast, as it comes with pre-configured packages for most systems.
For the sake of completeness, however, we’ll document the most important steps under Linux, Mac OS X, and Windows.</p>
</div>
<div class="sect2">
<h3 id="linux"><a class="anchor" href="Git-Book_13.html#linux"></a>A.1. Linux</h3>
<div class="paragraph">
<p>Due to the large number of Linux distributions only the installation on Debian, Fedora and Gentoo systems is described here.
For other distributions, please refer to the documentation or the package management system, if necessary; of course, you can also compile and install Git from source code.</p>
</div>
<div class="sect3">
<h4 id="sec.debian-ubuntu"><a class="anchor" href="Git-Book_13.html#sec.debian-ubuntu"></a>A.1.1. Debian/Ubuntu</h4>
<div class="paragraph">
<p>Debian and Ubuntu provide ready-to-use packages that can be installed comfortably and quickly with the Debian package management system.
The git installation is modularized, so you can install only certain parts of git if necessary.</p>
</div>
<div class="dlist">
<dl>
<dt class="hdlist1"><code>git</code></dt>
<dd>
<p>main package, contains core commands (formerly <code>git-core</code>)</p>
</dd>
<dt class="hdlist1"><code>git-email</code> </dt>
<dd>
<p>Add-on for sending patches by e-mail</p>
</dd>
<dt class="hdlist1"><code>git-gui</code> </dt>
<dd>
<p>Graphical user interface</p>
</dd>
<dt class="hdlist1"><code>git-svn</code></dt>
<dd>
<p>subcommand <code>svn</code> to interact with Subversion repositories</p>
</dd>
<dt class="hdlist1"><code>git-cvs</code> </dt>
<dd>
<p>Interaction with CVS</p>
</dd>
<dt class="hdlist1"><code>git-doc</code></dt>
<dd>
<p>documentation (will be installed under <code>/usr/share/doc</code>)</p>
</dd>
<dt class="hdlist1"><code>gitk</code> </dt>
<dd>
<p>Program Gitk</p>
</dd>
</dl>
</div>
<div class="paragraph">
<p>There is also a meta-package <code>git-all</code> which installs all relevant packages.
So on a regular workstation you should install Git as follows:</p>
</div>
<div class="listingblock">
<div class="content">
<pre>$ <strong>sudo aptitude install git-all</strong></pre>
</div>
</div>
<div class="paragraph">
<p>Under Ubuntu you can install the package <code>git-all</code> via the graphical package manager <em>Synaptic</em>.</p>
</div>
</div>
<div class="sect3">
<h4 id="sec.fedora"><a class="anchor" href="Git-Book_13.html#sec.fedora"></a>A.1.2. Fedora</h4>
<div class="paragraph">
<p>On a Fedora system, you should install Git using the package manager <code>yum</code>:</p>
</div>
<div class="listingblock">
<div class="content">
<pre>$ <strong>sudo yum install git</strong></pre>
</div>
</div>
<div class="paragraph">
<p>Analogous to the division into smaller packages as in Debian, certain additional features for Git are available in separate packages.
To install all commands, you should install the <code>git-all</code> package.</p>
</div>
</div>
<div class="sect3">
<h4 id="sec.gentoo"><a class="anchor" href="Git-Book_13.html#sec.gentoo"></a>A.1.3. Gentoo</h4>
<div class="paragraph">
<p>Gentoo provides the ebuild <code>dev-vcs/git</code>.
The graphical tool for creating commits (<code>git gui</code>) and the add-on for sending emails (<code>git send-email</code>) are installed by default.
If you want to have a graphical user interface for viewing and editing the history (<code>gitk</code>) in addition, enable the <em>USE flag</em> `tk`.
If you plan to use the Subversion interface, enable the <code>subversion</code> USE flag.
To install via Portage, type the following command:</p>
</div>
<div class="listingblock">
<div class="content">
<pre>$ <strong>sudo emerge dev-vcs/git</strong></pre>
</div>
</div>
</div>
<div class="sect3">
<h4 id="sec.quellcode-installation"><a class="anchor" href="Git-Book_13.html#sec.quellcode-installation"></a>A.1.4. Installation from Sources</h4>
<div class="paragraph">
<p>If your distribution doesn’t provide a package for Git, it’s outdated, or you don’t have root privileges on the system, you should install Git directly from source.</p>
</div>
<div class="paragraph">
<p>Git depends on the five libraries <code>expat</code> (XML parser), <code>curl</code> (data transfer), <code>zlib</code> (compression), <code>pcre</code> (regular expressions) and <code>openssl</code> (encryption/hashing).
You may need to compile their sources and install the libraries accordingly before proceeding.</p>
</div>
<div class="paragraph">
<p>First download the tarball of the current Git version<sup class="footnote">[<a id="_footnoteref_151" class="footnote" href="#_footnotedef_151" title="View footnote.">151</a>]</sup> and unzip it:</p>
</div>
<div class="listingblock">
<div class="content">
<pre>$ <strong>wget https://www.kernel.org/pub/software/scm/git/git-2.1.0.tar.gz</strong>
$ <strong>tar xvf git-2.1.0.tar.gz</strong></pre>
</div>
</div>
<div class="paragraph">
<p>Now change to the <code>git-2.1.0/</code> directory and compile the source code; then run <code>make install</code>:</p>
</div>
<div class="listingblock">
<div class="content">
<pre>$ <strong>cd git-2.1.0/</strong>
$ <strong>make -j8</strong>
$ <strong>make install</strong></pre>
</div>
</div>
<div class="paragraph">
<p>With <code>make prefix=<prefix></code> you can install Git to <code><prefix></code> (default: <code>$HOME</code>).</p>
</div>
</div>
</div>
<div class="sect2">
<h3 id="sec.osx"><a class="anchor" href="Git-Book_13.html#sec.osx"></a>A.2. Mac OS X</h3>
<div class="paragraph">
<p>The <em>Git for OS X</em> project provides an installation program in disk image format (DMG).<sup class="footnote">[<a id="_footnoteref_152" class="footnote" href="#_footnotedef_152" title="View footnote.">152</a>]</sup>
So you can install it as usual.</p>
</div>
</div>
<div class="sect2">
<h3 id="sec.windows"><a class="anchor" href="Git-Book_13.html#sec.windows"></a>A.3. Windows</h3>
<div class="paragraph">
<p>The project <em>Git for Windows</em> provides an installation program for Microsoft Windows: <em>msysGit</em>.
You can download the program<sup class="footnote">[<a id="_footnoteref_153" class="footnote" href="#_footnotedef_153" title="View footnote.">153</a>]</sup> and install it as usual.</p>
</div>
</div>
</div>
</div></div>
<div id="footnotes">
<hr>
<div class="footnote" id="_footnotedef_151">
<a href="#_footnoteref_151">151</a>. <a href="https://www.kernel.org/pub/software/scm/git/" class="bare" target="_blank" rel="noopener">https://www.kernel.org/pub/software/scm/git/</a>
</div>
<div class="footnote" id="_footnotedef_152">
<a href="#_footnoteref_152">152</a>. <a href="https://code.google.com/p/git-osx-installer/" class="bare" target="_blank" rel="noopener">https://code.google.com/p/git-osx-installer/</a>
</div>
<div class="footnote" id="_footnotedef_153">
<a href="#_footnoteref_153">153</a>. <a href="https://gitforwindows.org" class="bare" target="_blank" rel="noopener">https://gitforwindows.org</a>
</div>
</div>
<nav>
<a rel="prev" href="Git-Book_12.html" class="nav nav-prev" title="Previous page" aria-label="Previous page" aria-keyshortcuts="Left">
<i class="fa fa-angle-left"></i>
</a>
<a rel="next" href="Git-Book_14.html" class="nav nav-next" title="Next page" aria-label="Next page" aria-keyshortcuts="Right">
<i class="fa fa-angle-right"></i>
</a>
<div style="clear: both"></div>
</nav>
<div id="footer">
<div id="footer-text">
Version 3.0<br>
</div>
</div>
</body>
<script>
function isInViewport(ele) {
const rect = ele.getBoundingClientRect();
return (
rect.top >= 0 &&
rect.bottom <= (window.innerHeight || document.documentElement.clientHeight)
);
}
function yPosition (ele) {
const rect = ele.getBoundingClientRect();
return (rect.top - 20); // 20px above
}
let curr = document.getElementsByClassName('current');
if (!isInViewport(curr[curr.length - 1])) {
document.getElementById('toc').scrollTo({
top: yPosition(curr[0]),
left: 0,
behavior: 'smooth'
});
}
/* For page navigation */
function gotoPage(selector) {
const button = document.querySelector(selector);
if (button)
window.location.href = button.href;
}
document.addEventListener('keydown', e => {
switch (e.key) {
case 'ArrowRight':
e.preventDefault();
gotoPage('.nav-next');
break;
case 'ArrowLeft':
e.preventDefault();
gotoPage('.nav-prev');
break;
}
});
</script>
</html>