-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsetting-up-git.html
198 lines (190 loc) · 14.9 KB
/
setting-up-git.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Setting up git || Git & Github</title>
<link href="assets/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link href="assets/style.css" rel="stylesheet">
</head>
<body class="vh-100">
<div class="container-fluid h-100">
<div class="row minh-100">
<div class="bg-black minh-md-100 col-md-5 col-xxl-3 position-fixed z-2">
<div class="row w-md-100 mh-md-100vh align-items-center justify-content-start text-start">
<div class="col">
<div class="row">
<div class="container">
<nav class="navbar navbar-expand-md bg-black flex-row flex-md-column align-items-center align-items-md-start" data-bs-theme="dark">
<a class="navbar-brand w-md-100" href="index.html"><h1 class="fw-lighter fs-4 display-md-4 w-100 text-wrap">Introduction to Git and Github</h1></a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse flex-column align-items-start" id="navbarNav">
<span class="text-white mb-3 fw-lighter">By <a class="text-secondary" href="https://github.com/alepbloyd" target="_blank" rel="noopener noreferrer">Alex Boyd</a> and <a class="text-secondary" href="https://github.com/maxturer" target="_blank" rel="noopener noreferrer">Max Turer</a></span>
<ul class="navbar-nav nav-underline flex-md-column text-uppercase">
<li class="nav-item"><a class="nav-link" aria-current="page" href="index.html">Home</a></li>
<li class="nav-item"><a class="nav-link" href="what-is-git.html">What is Git?</a></li>
<li class="nav-item"><a class="nav-link active" href="setting-up-git.html">Setting up Git</a></li>
<li class="nav-item"><a class="nav-link" href="guide.html">Git basics</a></li>
<li class="nav-item">
<a class="nav-link" href="push-guide.html"
>Pushing to GitHub</a
>
</li>
<li class="nav-item"><a class="nav-link" href="links.html">Links for further reading</a></li>
</ul>
</div>
</nav>
</div>
</div>
</div>
</div>
</div>
<div class="col col-right">
<div class="row h-md-100 flex-column align-items-center justify-content-center">
<div class="col p-3 fade-in fw-light">
<h1 class="fw-lighter">Setting up Git</h1>
<ul class="nav nav-tabs align-items-center flex-column flex-md-row" id="OSTab" role="tablist">
<div>
<li class="nav-item fw-light p-1" role="presentation">
<span class="active" id="choose-tab" data-bs-toggle="tab" data-bs-target="#choose-tab-pane" role="tab" aria-controls="choose-tab-pane" aria-selected="true">Choose your OS:</span>
</li>
</div>
<div class="flex-pls flex-row">
<li class="nav-item" role="presentation">
<button class="nav-link" id="mac-tab" data-bs-toggle="tab" data-bs-target="#mac-tab-pane" type="button" role="tab" aria-controls="mac-tab-pane" aria-selected="false">On a MAC</button>
</li>
<li class="nav-item" role="presentation">
<button class="nav-link" id="windows-tab" data-bs-toggle="tab" data-bs-target="#windows-tab-pane" type="button" role="tab" aria-controls="windows-tab-pane" aria-selected="false">On WINDOWS</button>
</li>
<li class="nav-item" role="presentation">
<button class="nav-link" id="linux-tab" data-bs-toggle="tab" data-bs-target="#linux-tab-pane" type="button" role="tab" aria-controls="linux-tab-pane" aria-selected="false">On LINUX</button>
</li>
</div>
</ul>
<div class="tab-content" id="OSTabContent">
<div class="tab-pane fade show active p-2" id="choose-tab-pane" role="tabpanel" aria-labelledby="choose-tab" tabindex="0">
<p class="display-3 fw-lighter">
What operating system is your computer running?
</p>
</div>
<div class="tab-pane fade show p-2" id="mac-tab-pane" role="tabpanel" aria-labelledby="mac-tab" tabindex="0">
<h2 class="fw-lighter">On a MAC</h2>
<p>
Open your <b class="text-uppercase">Terminal</b>. You can do this with <span class="code p-1">command + spacebar</span>, then start typing "terminal" and hit enter when it has auto-completed.
</p>
<p>
If you do not have <b class="text-uppercase">Homebrew</b> installed (or don't know what <b class="text-uppercase">Homebrew</b> is), run: <br>
<span class="code p-1">/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"</span>
</p>
<p>
This will prompt you for the password you use to log in to your computer. Enter your password and press <span class="code p-1">enter</span> on your keyboard to begin the installation.
</p>
<p>
Once <b class="text-uppercase">Homebrew</b> has finished installing, there will be two commands under "Next steps" in the output, they will look something like: <br>
<span class="code p-1">
(echo; echo ‘eval “$(/opt/homebrew/bin/brew shellenv)”’) >> /Users/your-user-name/.zprofile <br>
eval “$(/opt/homebrew/bin/brew shellenv)”
</span>
</p>
<p>
Copy and paste the lines from the output into your terminal and press enter. <br>
Now quit your terminal and re-open it for changes to take effect.
</p>
<p>
Once you have re-opened your terminal with Homebrew installed, run: <span class="code p-1">brew install git</span>
</p>
<p>
This should install git. Once the process is completed, try typing <span class="code p-1">git</span> in the terminal and pressing <span class="code p-1">enter</span>. <br>
If git has been installed correctly, you should see output with <span class="code p-1">usage</span> and other tips about using git.
</p>
</div>
<div class="tab-pane fade p-2" id="windows-tab-pane" role="tabpanel" aria-labelledby="windows-tab" tabindex="0">
<h2 class="fw-lighter">On WINDOWS</h2>
<p>
Install <a href="https://gitforwindows.org/" target="_blank" rel="noopener noreferrer">Git for Windows</a>.
</p>
<p>
Once installation has completed, open the program.
</p>
<p>
Type <span class="code p-1">git</span> and push <span class="code p-1">enter</span> - you should see output with <span class="code p-1">usage</span> and other tips about using git.
</p>
</div>
<div class="tab-pane fade p-2" id="linux-tab-pane" role="tabpanel" aria-labelledby="linux-tab" tabindex="0">
<h2 class="fw-lighter">On LINUX</h2>
<p>
Open your <span class="text-uppercase">terminal</span>. You can use <span class="code p-1">Ctrl + Alt + T</span>, or find it in your applications menu.
</p>
<p>
On a Debian-based distribution (such as <span class="text-uppercase">Ubuntu</span>), try <span class="code p-1">apt</span>. Enter the following into your terminal: <span class="code p-1">sudo apt install git-all</span>
</p>
<p>
On a different distribution (such as <span class="text-uppercase">Fedora</span> or <span class="text-uppercase">Arch</span>) that does not use <span class="code p-1">apt</span>, you can find similar commands in <a href="https://git-scm.com/downloads/linux" target="_blank" rel="noopener noreferrer">the Git documentation</a>.
</p>
</div>
</div>
</div>
<div class="col p-3 text-end fade-in fade-2 border-black border-top fw-light">
<h1 class="fw-lighter">Configuring Git</h1>
<p>
Run these lines one at a time, substituting your name in the first line and your email (the email you registered for GitHub with) in the second line:
</p>
<p><span class="code p-1">git config --global user.name "George Washington"</span></p>
<p><span class="code p-1">git config --global user.email [email protected]</span></p>
<p><span class="code p-1">git config --global init.defaultBranch main</span></p>
<p><span class="code p-1">git config --global core.editor "code --wait"</span></p>
<p><span class="code p-1">git config --global pull.rebase false</span></p>
</div>
<div class="col p-3 text-start fade-in fade-3 border-black border-top">
<h1 class="fw-lighter">Connecting Git to GitHub</h1>
<div class="container">
<div class="row">
<div class="col p-3 fw-light">
<h2>Setting up SSH</h2>
<p>
In your terminal or git-bash, run this command with the email associated with your GitHub account: <br>
<span class="code p-1">ssh-keygen -t rsa -C “[email protected]”</span>
</p>
<p>
When it asks you to “Enter a file in which to save the key”, press <span class="code p-1">enter</span> to save it to the default location.
</p>
<p>
When it asks you to enter a password, press <span class="code p-1">enter</span> to skip using a password.
</p>
<p>In your terminal, run: <span class="code p-1">ssh-add ~/.ssh/id_rsa</span></p>
<p>
In your terminal, run the following command to add your key to the clipboard: <span class="code p-1">pbcopy < ~/.ssh/id_rsa.pub</span>
</p>
<p>
<i>While logged into your GitHub account</i>, go to: <br>
<span class="code p-1">https://github.com/settings/keys</span> <br>
Click on the green “New SSH key” button. <br>
Leave the title blank, and then paste your key into the “key” section. <br>
Click the green “Add SSH key” button.
</p>
</div>
<div class="col p-3 fw-light">
<h2>Testing SSH Connection</h2>
<p>
In your terminal, run: <span class="code p-1">ssh -T [email protected]</span>
</p>
<p>
If the output says <span class="code p-1">“The authenticity of host 'github.com' .... can't be established ... Are you sure you want to continue connecting (yes/no)?”</span> Type <span class="code p-1">yes</span> and hit <span class="code p-1">enter</span>.
</p>
<p>
You should see <span class="code p-1">Hi <your_username>! You've successfully authenticated, but GitHub does not provide shell access</span>.
</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="assets/bootstrap/js/bootstrap.min.js"></script>
</body>
</html>