- 前端小白
- windows 用户
- 懒癌晚期患者
- 一个Github 账户
- 安装[Git]( https://pan.baidu.com/s/1dFKYu5r,'windows 国内镜像')
- 安装Node.js
### Step 1, 创建一个 Github page
- Repo name 的填写格式为
Github 名 + github.io
。举个栗子,我的 repo name 为cnscorpions.github.io
- Description 可以写
static blog/blog
,反正你随意就好- 点击创建 repo
Step 2, Hexo 安装以配置 (假设你已经安装好 Git 和 Node.js )
- 打开 Git bash 命令行
- 安装 NPM ---> Taobao NPM 镜像 (因为网络环境不好,你懂的)
$ npm install -g cnpm --registry=https://registry.npm.taobao.org
- 安装 Hexo
$ cnpm install -g hexo-cli
- 创建 blog 根目录
$ hexo init blog
- 生成静态文件
$ hexo g
- 安装 Hexo-server 模块
$ cnpm install hexo-server --save
- 运行本地服务器 (一定要在 blog 根目录下运行)
$ hexo s
- 打开
http://localhost:4000/
已经可以看到一篇内置的 blog 了
Step 3, 安装 Hexo 主题 ( Git 在线安装 VS 本地安装)
- Git 安装
$ hexo clean
$ git clone https://github.com/iissnan/hexo-theme-next
- 修改配置文件
_config.yml/theme ---> next
- 更新主题
$ hexo c
$ hexo g
$ hexo s
Step 4, 安装 SSH
- 安装 hexo-deployer-git 模块
$ cnpm install hexo-deployer-git --save
- 修改配置文件
deploy:
type: git
repo: https://github.com/cnscorpions/cnscorpions.github.io.git
branch: master
- 检查电脑中是否存在 SSH key
$ ls -al ~/.ssh
- 创建新的 SSH key
$ ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
Enter a file in which to save the key (/c/Users/you/.ssh/id_rsa):[Press enter] ---> 不要移动文件位置
Enter passphrase (empty for no passphrase): [Type a passphrase]
Enter same passphrase again: [Type passphrase again]
- 复制 id_rsa.pug
- 复制到 Github SSH key
- 搞定
$ hexo g ---> $ hexo d ----> OVER
PS: 暂时先这样了,欢迎拍砖!
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.