Hello World
本文最后更新于:2026年3月3日 晚上
Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.
Quick Start
Create a new post
1 | |
1 | |
More info: Writing
Run server
1 | |
More info: Server
Generate static files
1 | |
More info: Generating
Deploy to remote sites
1 | |
More info: Deployment
引用知乎原文
作者:CrazyMilk
链接:https://www.zhihu.com/question/21193762/answer/79109280
来源:知乎
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
一、关于搭建的流程
- 创建仓库,http://CrazyMilk.github.io;
- 创建两个分支:master 与 hexo;
- 设置hexo为默认分支(因为我们只需要手动管理这个分支上的Hexo网站文件);
- 使用git clone git@github.com:CrazyMilk/CrazyMilk.github.io.git拷贝仓库;
- 在本地http://CrazyMilk.github.io文件夹下通过Git bash依次执行npm install hexo、hexo init、npm install 和 npm install hexo-deployer-git(此时当前分支应显示为hexo);
- 修改_config.yml中的deploy参数,分支应为master;
- 依次执行git add .、git commit -m “…”、git push origin hexo提交网站相关的文件;
- 执行hexo g -d生成网站并部署到GitHub上。
这样一来,在GitHub上的http://CrazyMilk.github.io仓库就有两个分支,一个hexo分支用来存放网站的原始文件,一个master分支用来存放生成的静态网页。完美( •̀ ω •́ )y!
二、关于日常的改动流程在本地对博客进行修改(添加新博文、修改样式等等)后,通过下面的流程进行管理。
- 依次执行git add .、git commit -m “…”、git push origin hexo指令将改动推送到GitHub(此时当前分支应为hexo);
- 然后才执行hexo g -d发布网站到master分支上。虽然两个过程顺序调转一般不会有问题,不过逻辑上这样的顺序是绝对没问题的(例如突然死机要重装了,悲催….的情况,调转顺序就有问题了)。
三、本地资料丢失后的流程当重装电脑之后,或者想在其他电脑上修改博客,可以使用下列步骤:
- 使用git clone git@github.com:CrazyMilk/CrazyMilk.github.io.git拷贝仓库(默认分支为hexo);
- 在本地新拷贝的http://CrazyMilk.github.io文件夹下通过Git bash依次执行下列指令:npm install hexo、npm install、npm install hexo-deployer-git(记得,不需要hexo init这条指令)。
Hello World
https://southcold.top/2026/03/03/hello-world/