-
Notifications
You must be signed in to change notification settings - Fork 0
/
将静态网站挂载到github域名下面.html
275 lines (133 loc) · 11.8 KB
/
将静态网站挂载到github域名下面.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
<!DOCTYPE HTML>
<html lang="" >
<head>
<meta charset="UTF-8">
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>将静态网站挂载到github域名下面 · GitBook</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="description" content="">
<meta name="generator" content="GitBook 3.2.3">
<link rel="stylesheet" href="gitbook/style.css">
<link rel="stylesheet" href="gitbook/gitbook-plugin-highlight/website.css">
<link rel="stylesheet" href="gitbook/gitbook-plugin-search/search.css">
<link rel="stylesheet" href="gitbook/gitbook-plugin-fontsettings/website.css">
<meta name="HandheldFriendly" content="true"/>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="gitbook/images/apple-touch-icon-precomposed-152.png">
<link rel="shortcut icon" href="gitbook/images/favicon.ico" type="image/x-icon">
<link rel="prev" href="./" />
</head>
<body>
<div class="book">
<div class="book-summary">
<div id="book-search-input" role="search">
<input type="text" placeholder="Type to search" />
</div>
<nav role="navigation">
<ul class="summary">
<li class="chapter " data-level="1.1" data-path="./">
<a href="./">
Introduction
</a>
</li>
<li class="chapter active" data-level="1.2" data-path="将静态网站挂载到github域名下面.html">
<a href="将静态网站挂载到github域名下面.html">
将静态网站挂载到github域名下面
</a>
</li>
<li class="divider"></li>
<li>
<a href="https://www.gitbook.com" target="blank" class="gitbook-link">
Published with GitBook
</a>
</li>
</ul>
</nav>
</div>
<div class="book-body">
<div class="body-inner">
<div class="book-header" role="navigation">
<!-- Title -->
<h1>
<i class="fa fa-circle-o-notch fa-spin"></i>
<a href="." >将静态网站挂载到github域名下面</a>
</h1>
</div>
<div class="page-wrapper" tabindex="-1" role="main">
<div class="page-inner">
<div id="book-search-results">
<div class="search-noresults">
<section class="normal markdown-section">
<center><h1 id="将静态网站挂载到github域名下面">将静态网站挂载到github域名下面</h1></center>
<p> <u>将静态网站挂载到github域名下面有两种方式,一种是以个人主页的形式,另一种是以项目主页的形式</u></p>
<h4 id="一、-将静态网站挂载到github的个人主页域名,每个账号只能有一个个人主页">一、 将静态网站挂载到github的<u>个人主页</u>域名,每个账号只能有一个<u>个人主页</u></h4>
<p>首先按照 [官网教程][<a href="https://pages.github.com/" target="_blank">https://pages.github.com/</a>] 创建一个仓库</p>
<ul>
<li>按照官网教程,新创建的仓库名应该是<strong>username.github.io</strong></li>
<li>然后将这个仓库下载到本地:
<code>git clone https://github.com/username/username.github.io</code></li>
<li>将静态网站拷贝到刚生成的仓库目录(username.github.io)里面</li>
<li>进入username.github.io目录里面:<code>cd username.github.io</code></li>
<li>接下来连续执行三条命令<pre><code>git add .
git commit -m "first commit"
git push
</code></pre></li>
<li>然后在浏览器打开网址:<a href="https://username.github.io/" target="_blank">https://username.github.io/</a> 就可以看到你的静态网站了</li>
</ul>
<h4 id="二、-将静态网站挂载到github的项目主页域名,每个账号可以有多个项目主页">二、 将静态网站挂载到github的<u>项目主页</u>域名,每个账号可以有多个<u>项目主页</u></h4>
<ul>
<li>在github上随便创建一个仓库,假如仓库名为<u><strong>book</strong></u></li>
<li>然后将这个仓库下载到本地:
<code>git clone https://github.com/username/book.git</code></li>
<li>进入刚生成的仓库目录里面:<code>cd book</code></li>
<li>在book目录里新建一个github-page分支:<code>git checkout -b gh-pages</code></li>
<li>将静态网站拷贝到book目录里面</li>
<li>接下来连续执行三条命令<pre><code>git add .
git commit -m "first commit"
git push -u origin gh-pages
</code></pre></li>
<li>然后等个几分钟访问 <a href="https://username.github.io/book/" target="_blank">https://username.github.io/book/</a> 即可</li>
</ul>
<h4 id="三、-将gitbook生成的静态网站放置到github域名下访问">三、 将gitbook生成的静态网站放置到github域名下访问</h4>
<ul>
<li>使用gitbook build构建好静态网站,将构建好的静态网站目录拷贝到以上第一步的username.github.io目录下或者第二步的book目录下,然后顺着第一步或者第二步的步骤执行下去即可</li>
</ul>
</section>
</div>
<div class="search-results">
<div class="has-results">
<h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
<ul class="search-results-list"></ul>
</div>
<div class="no-results">
<h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
</div>
</div>
</div>
</div>
</div>
</div>
<a href="./" class="navigation navigation-prev navigation-unique" aria-label="Previous page: Introduction">
<i class="fa fa-angle-left"></i>
</a>
</div>
<script>
var gitbook = gitbook || [];
gitbook.push(function() {
gitbook.page.hasChanged({"page":{"title":"将静态网站挂载到github域名下面","level":"1.2","depth":1,"previous":{"title":"Introduction","level":"1.1","depth":1,"path":"README.md","ref":"README.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":["livereload"],"pluginsConfig":{"livereload":{},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"将静态网站挂载到github域名下面.md","mtime":"2019-10-18T10:35:27.980Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2019-10-18T11:02:20.505Z"},"basePath":".","book":{"language":""}});
});
</script>
</div>
<script src="gitbook/gitbook.js"></script>
<script src="gitbook/theme.js"></script>
<script src="gitbook/gitbook-plugin-livereload/plugin.js"></script>
<script src="gitbook/gitbook-plugin-search/search-engine.js"></script>
<script src="gitbook/gitbook-plugin-search/search.js"></script>
<script src="gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
<script src="gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
<script src="gitbook/gitbook-plugin-sharing/buttons.js"></script>
<script src="gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
</body>
</html>