github+hexo搭建博客步骤

-

此篇写一下我搭建博客时的步骤与所犯的一些错误

所需原料

1.github
2.node.js

基本步骤


安装和配置好github与node.js

1.打开git bash运行

1
npm install -g hexo

2.在电脑中创建一个文件夹(eg:D:\git\Hexo),进入到文件夹中运行

1
npm install

本地的博客就搭建完成,运行heox sever检测,出现

1
INFO  Hexo is running at http://0.0.0.0:4000/. Press Ctrl+C to stop.

就表示成功

3.运行

1
hexo generate

生成静态网页

4.部署到github前的准备工作

1.首先在github创建一个与用户名相同的repository

1
格式为:mrnoknow.github.io  mrnoknow 为自己的用户名

2.找到Hexo文件夹下的_config.yml文件,找到文件里的

1
2
deploy:
type:

改为

1
2
3
4
5
deploy:
type: git
repository: git@github.com:Mrnoknow/mrnoknow.github.io.git (这个为自己repository的ssh连接)
branch: master
(特别注意空格问题(eg:type: 这里有一个空格后面再加git))

5.部署到github,只要依次运行一下命令

1
2
3
npm clean
npm generate
hexo deploy

当运行hexo deploy 出现错误后,运行下面的命令

1
npm install hexo-server --save

然后重新执行,就ok

我出现的问题就是版本问题,建议换低版本的git

在VMware11下安装Mac10.10

-

在安装之前你必须确保你有以下3种东西
1.VMware11
2.mac10.10虚拟镜像
3.unlocker 203(必须有这个在VMware中才能找到mac选项)

基本操作步骤

1.安装VMware
2.下载unlocker 203
3.运行unlocker 203中的 win-install.cmd(unlock203\win-install.cmd)
4.运行VMware,添加新的虚拟机
5.选择你下载下来的镜像,继续你会发现有一个Apple Mac OS选项,选择OS X 10.10
6.之后一直默认就可以
7.运行后会提示一个错误,找到你Mac虚拟机安装的位置,找到 OS X 10.10.vmx 这个
文件然后添加 smc.version = ”0“.
8.ok,运行虚拟机,然后安装。
9.在安装时的第二步骤进入到 磁盘工具 抹掉盘,进行分区

搭建Hexo+github的错误

-

在搭建github+Hexo博客时,因为版本的问题一直无法将博客搭建成功

错误信息如下

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
INFO  Deploying: git
INFO Clearing .deploy folder...
INFO Copying files from public folder...
warning: LF will be replaced by CRLF in 2015/11/26/hello-world/index.html.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in archives/2015/11/index.html.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in archives/2015/index.html.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in archives/index.html.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in css/fonts/fontawesome-webfont.svg.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in css/style.css.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in fancybox/helpers/jquery.fancybox-buttons.css.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in fancybox/helpers/jquery.fancybox-buttons.js.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in fancybox/helpers/jquery.fancybox-media.js.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in fancybox/helpers/jquery.fancybox-thumbs.css.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in fancybox/helpers/jquery.fancybox-thumbs.js.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in fancybox/jquery.fancybox.css.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in fancybox/jquery.fancybox.js.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in fancybox/jquery.fancybox.pack.js.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in index.html.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in js/script.js.
The file will have its original line endings in your working directory.
On branch master
nothing to commit, working directory clean

fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
FATAL Something's wrong. Maybe you can find the solution here: http://hexo.io/docs/troubleshooting.html
Error: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

at ChildProcess.<anonymous> (F:\git\Git\Hexo\node_modules\hexo-deployer-git\node_modules\hexo-util\lib\spawn.js:42:17)
at emitTwo (events.js:87:13)
at ChildProcess.emit (events.js:172:7)
at maybeClose (internal/child_process.js:818:16)
at Socket.<anonymous> (internal/child_process.js:319:11)
at emitOne (events.js:77:13)
at Socket.emit (events.js:169:7)
at Pipe._onclose (net.js:469:12)

解决方法

1
用低版本的git,比如1.9版本的git  或者执行   ssh-add ~/.ssh/自定义名