1313创建个人主页
1414--------------
1515
16- GitHub 为每一个用户分配了一个二级域名\ ``<user-id>.github.com ``\ ,用户为自己\
17- 的二级域名创建主页很容易,只要在托管空间下创建一个名为\ ``<user-id>.github.com ``\
16+ GitHub 为每一个用户分配了一个二级域名\ ``<user-id>.github.io ``\ ,用户为自己\
17+ 的二级域名创建主页很容易,只要在托管空间下创建一个名为\ ``<user-id>.github.io ``\
1818的版本库,向其\ ``master ``\ 分支提交网站静态页面即可,其中网站首页为\
1919``index.html ``\ 。下面以\ ``gotgithub ``\ 用户为例介绍如何创建个人主页。
2020
21- * 用户\ ``gotgithub ``\ 创建一个名为\ ``gotgithub.github.com ``\ 的Git版本库。
21+ * 用户\ ``gotgithub ``\ 创建一个名为\ ``gotgithub.github.io ``\ 的Git版本库。
2222
2323 在GitHub上创建版本库的操作,参见“第3.1节 :ref: `new-project `\ ”。
2424
2525* 在本地克隆新建立的版本库。
2626
2727 ::
2828
29- $ git clone git@github.com:gotgithub/gotgithub.github.com .git
30- $ cd gotgithub.github.com /
29+ $ git clone git@github.com:gotgithub/gotgithub.github.io .git
30+ $ cd gotgithub.github.io /
3131
3232* 在版本库根目录中创建文件\ ``index.html ``\ 作为首页。
3333
@@ -48,7 +48,7 @@ GitHub 为每一个用户分配了一个二级域名\ ``<user-id>.github.com``\
4848
4949 $ git push origin master
5050
51- * 访问网址: http://gotgithub.github.com / 。
51+ * 访问网址: http://gotgithub.github.io / 。
5252
5353 最多等待10分钟,GitHub就可以完成新网站的部署。网站完成部署后版本库\
5454 的所有者会收到邮件通知。
@@ -60,17 +60,17 @@ GitHub 为每一个用户分配了一个二级域名\ ``<user-id>.github.com``\
6060创建项目主页
6161---------------
6262
63- 如前所述,GitHub会为每个账号分配一个二级域名\ ``<user-id>.github.com ``\
63+ 如前所述,GitHub会为每个账号分配一个二级域名\ ``<user-id>.github.io ``\
6464作为用户的首页地址。实际上还可以为每个项目设置主页,项目主页也通过\
6565此二级域名进行访问。
6666
6767例如\ ``gotgithub ``\ 用户创建的\ ``helloworld ``\ 项目如果启用了项目主页,\
68- 则可通过网址\ ``http://gotgithub.github.com /helloworld/ ``\ 访问。
68+ 则可通过网址\ ``http://gotgithub.github.io /helloworld/ ``\ 访问。
6969
7070为项目启用项目主页很简单,只需要在项目版本库中创建一个名为\ ``gh-pages ``\
7171的分支,并向其中添加静态网页即可。也就是说如果项目的Git版本库中包含了名为\
7272``gh-pages ``\ 分支的话,则表明该项目提供静态网页构成的主页,可以通过网址\
73- ``http://<user-id>.github.com /<project-name> ``\ 访问到。
73+ ``http://<user-id>.github.io /<project-name> ``\ 访问到。
7474
7575下面以用户\ ``gotgithub ``\ 的项目\ ``helloworld ``\ 为例,介绍如何维护项目主页。
7676
@@ -221,7 +221,7 @@ GitHub 为每一个用户分配了一个二级域名\ ``<user-id>.github.com``\
221221
222222无论哪种方法,一旦在GitHub远程版本库中创建分支\ ``gh-pages ``\ ,项目的主页\
223223就已经建立。稍后(不超过10分钟),用浏览器访问下面的地址即可看到刚刚提交的\
224- 项目首页: http://gotgithub.github.com /helloworld/ 。
224+ 项目首页: http://gotgithub.github.io /helloworld/ 。
225225
226226除了以上通过命令行创建\ ``gh-pages ``\ 分支为项目设定主页之外,GitHub还提供\
227227了图形操作界面。如图3-19所示。
@@ -256,32 +256,32 @@ GitHub 为每一个用户分配了一个二级域名\ ``<user-id>.github.com``\
256256
257257首先按照前面章节介绍的步骤,为账号\ ``gotgit ``\ 设置账户主页。
258258
259- 1. 在账户\ ``gotgit ``\ 下创建版本库\ ``gotgit.github.com ``\ 以维护该账号主页。
259+ 1. 在账户\ ``gotgit ``\ 下创建版本库\ ``gotgit.github.io ``\ 以维护该账号主页。
260260
261- 地址: https://github.com/gotgit/gotgit.github.com /
261+ 地址: https://github.com/gotgit/gotgit.github.io /
262262
2632632. 将网站内容提交并推送到该版本库\ ``master ``\ 分支中。
264264
265- 即在\ ``gotgit.github.com ``\ 版本库的根目录下至少包含一个首页文件,如\
265+ 即在\ ``gotgit.github.io ``\ 版本库的根目录下至少包含一个首页文件,如\
266266 ``index.html ``\ 。还可以使用下节将要介绍到的 Jekyll 技术,让网页有统一的\
267267 显示风格,此时首页文件可能并非一个完整的HTML文档,而是套用了页面模版。
268268
269- 3. 至此当访问网址\ http://gotgit.github.com \ 时,会将账号\ ``gotgit ``\
270- 的版本库\ ``gotgit.github.com ``\ 中的内容作为网站内容显示出来。
269+ 3. 至此当访问网址\ http://gotgit.github.io \ 时,会将账号\ ``gotgit ``\
270+ 的版本库\ ``gotgit.github.io ``\ 中的内容作为网站内容显示出来。
271271
272272接下来进行如下操作,使得该网站能够使用专有域名\ ``www.worldhello.net ``\
273273提供服务。
274274
275- 1. 在账号\ ``gotgit ``\ 的版本库\ ``gotgit.github.com ``\ 根目录下添加文件\
275+ 1. 在账号\ ``gotgit ``\ 的版本库\ ``gotgit.github.io ``\ 根目录下添加文件\
276276 ``CNAME ``\ ,文件内容为:\ ``www.worldhello.net ``\ 。
277277
278- 参见: https://github.com/gotgit/gotgit.github.com /blob/master/CNAME
278+ 参见: https://github.com/gotgit/gotgit.github.io /blob/master/CNAME
279279
280- 2. 然后更改域名\ ``www.worldhello.net ``\ 的IP地址,指向域名\ ``gotgit.github.com ``\
280+ 2. 然后更改域名\ ``www.worldhello.net ``\ 的IP地址,指向域名\ ``gotgit.github.io ``\
281281 对应的IP地址(注意不是\ ``github.com ``\ 的IP地址)。
282282
283283 完成域名的DNS指向后,可试着用\ ``ping ``\ 或\ ``dig ``\ 命令确认域名\
284- ``www.worldhello.net ``\ 和\ ``gotgit.github.com ``\ 指向同一IP地址。
284+ ``www.worldhello.net ``\ 和\ ``gotgit.github.io ``\ 指向同一IP地址。
285285
286286 ::
287287
@@ -290,13 +290,13 @@ GitHub 为每一个用户分配了一个二级域名\ ``<user-id>.github.com``\
290290 ; ANSWER SECTION:
291291 www.worldhello.net. 81078 IN A 204.232.175.78
292292
293- $ dig @8.8.8.8 -t a gotgit.github.com
293+ $ dig @8.8.8.8 -t a gotgit.github.io
294294 ...
295295 ; ANSWER SECTION:
296- gotgit.github.com . 43200 IN A 204.232.175.78
296+ gotgit.github.io . 43200 IN A 204.232.175.78
297297
298298设置完成后用浏览器访问 http://www.worldhello.net/ 即可看到由账号\ ``gotgit ``\
299- 的版本库\ ``gotgit.github.com ``\ 维护的页面。若将域名\ ``worldhello.net ``\
299+ 的版本库\ ``gotgit.github.io ``\ 维护的页面。若将域名\ ``worldhello.net ``\
300300(不带www前缀)也指向IP地址\ ``204.232.175.78 ``\ ,则访问网址\
301301http://worldhello.net/\ 会发现GitHub体贴地将该网址重定向到正确的地址\
302302http://www.worldhello.net/\ 。
0 commit comments