forked from swcarpentry/git-novice
-
Notifications
You must be signed in to change notification settings - Fork 0
/
02-setup.html
124 lines (124 loc) · 5.97 KB
/
02-setup.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="generator" content="pandoc">
<title>Software Carpentry: Version Control with Git</title>
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" type="text/css" href="css/bootstrap/bootstrap.css" />
<link rel="stylesheet" type="text/css" href="css/bootstrap/bootstrap-theme.css" />
<link rel="stylesheet" type="text/css" href="css/swc.css" />
<link rel="alternate" type="application/rss+xml" title="Software Carpentry Blog" href="http://software-carpentry.org/feed.xml"/>
<meta charset="UTF-8" />
<!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body class="lesson">
<div class="container card">
<div class="banner">
<a href="http://software-carpentry.org" title="Software Carpentry">
<img alt="Software Carpentry banner" src="img/software-carpentry-banner.png" />
</a>
</div>
<article>
<div class="row">
<div class="col-md-10 col-md-offset-1">
<a href="index.html"><h1 class="title">Version Control with Git</h1></a>
<h2 class="subtitle">Setting Up Git</h2>
<section class="objectives panel panel-warning">
<div class="panel-heading">
<h2><span class="glyphicon glyphicon-certificate"></span>Learning Objectives</h2>
</div>
<div class="panel-body">
<ul>
<li>Configure <code>git</code> the first time is used on a computer.</li>
<li>Understand the meaning of the <code>--global</code> configuration flag.</li>
</ul>
</div>
</section>
<p>When we use Git on a new computer for the first time, we need to configure a few things. Here’s how Dracula sets up his new laptop:</p>
<pre class="sourceCode bash"><code class="sourceCode bash">$ <span class="kw">git</span> config --global user.name <span class="st">"Vlad Dracula"</span>
$ <span class="kw">git</span> config --global user.email <span class="st">"vlad@tran.sylvan.ia"</span>
$ <span class="kw">git</span> config --global color.ui <span class="st">"auto"</span></code></pre>
<p>(Please use your own name and email address instead of Dracula’s.)</p>
<p>He also has to set his favorite text editor, following this table:</p>
<table>
<thead>
<tr class="header">
<th align="left">Editor</th>
<th align="left">Configuration command</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td align="left">nano</td>
<td align="left"><code>$ git config --global core.editor "nano -w"</code></td>
</tr>
<tr class="even">
<td align="left">Text Wrangler</td>
<td align="left"><code>$ git config --global core.editor "edit -w"</code></td>
</tr>
<tr class="odd">
<td align="left">Sublime Text (Mac)</td>
<td align="left"><code>$ git config --global core.editor "subl -n -w"</code></td>
</tr>
<tr class="even">
<td align="left">Sublime Text (Win)</td>
<td align="left"><code>$ git config --global core.editor "'c:/program files/sublime text 2/sublime_text.exe' -w"</code></td>
</tr>
<tr class="odd">
<td align="left">Notepad++ (Win)</td>
<td align="left"><code>$ git config --global core.editor "'c:/program files (x86)/Notepad++/notepad++.exe' -multiInst -notabbar -nosession -noPlugin"</code></td>
</tr>
<tr class="even">
<td align="left">Kate (Linux)</td>
<td align="left"><code>$ git config --global core.editor "kate"</code></td>
</tr>
<tr class="odd">
<td align="left">Gedit (Linux)</td>
<td align="left"><code>$ git config --global core.editor "gedit -s"</code></td>
</tr>
</tbody>
</table>
<p>Git commands are written <code>git verb</code>, where <code>verb</code> is what we actually want it to do. In this case, we’re telling Git:</p>
<ul>
<li>our name and email address,</li>
<li>to colorize output,</li>
<li>what our favorite text editor is, and</li>
<li>that we want to use these settings globally (i.e., for every project),</li>
</ul>
<p>The four commands above only need to be run once: the flag <code>--global</code> tells Git to use the settings for every project on this computer.</p>
<p>You can check your settings at any time:</p>
<pre class="sourceCode bash"><code class="sourceCode bash">$ <span class="kw">git</span> config --list</code></pre>
<p>You can change your configuration as many times as you want: just use the same commands to choose another editor or update your email address.</p>
<aside class="callout panel panel-info">
<div class="panel-heading">
<h2><span class="glyphicon glyphicon-pushpin"></span>Proxy</h2>
</div>
<div class="panel-body">
<p>In some networks you need to use a <a href="https://en.wikipedia.org/wiki/Proxy_server">proxy</a>. If this is the case, you may also need to tell Git about the proxy:</p>
<pre class="sourceCode bash"><code class="sourceCode bash">$ <span class="kw">git</span> config --global http.proxy proxy-url
$ <span class="kw">git</span> config --global https.proxy proxy-url</code></pre>
<p>To disable the proxy, use</p>
<pre class="sourceCode bash"><code class="sourceCode bash">$ <span class="kw">git</span> config --global --unset http.proxy
$ <span class="kw">git</span> config --global --unset https.proxy</code></pre>
</div>
</aside>
</div>
</div>
</article>
<div class="footer">
<a class="label swc-blue-bg" href="http://software-carpentry.org">Software Carpentry</a>
<a class="label swc-blue-bg" href="https://github.com/swcarpentry/git-novice">Source</a>
<a class="label swc-blue-bg" href="mailto:admin@software-carpentry.org">Contact</a>
<a class="label swc-blue-bg" href="LICENSE.html">License</a>
</div>
</div>
<!-- Javascript placed at the end of the document so the pages load faster -->
<script src="http://software-carpentry.org/v5/js/jquery-1.9.1.min.js"></script>
<script src="css/bootstrap/bootstrap-js/bootstrap.js"></script>
</body>
</html>