转载请表明出处 https://blog.csdn.net/Amor_Leo/article/details/85396596 谢谢
安装git
- 官网 一路next.(可以自定义安装目录)
安装node.js
- 官网 一路next.(可以自定义安装目录)
安装hexo
- 安装hexo
打开git bash或者(cmd)
npm install -g hexo-cli
- 初始化Hexo
打开git bash或者(cmd)
hexo init <folder>
cd <folder>
npm install
├── node_modules #npm依赖包
├── scaffolds #文章等模板
├── source #博客正文和其他源文件
├── themes #主题
├── _config.yml #配置文件
├── db.json #source解析得到的
├── package.json #定义了hexo所需要的各种模块
└── package-lock.json
- 启动服务器
打开Git Bash
hexo server
打开 http://localhost:4000
hexo发布至github(coding双部署)
创建github账号
- github sign up
创建仓库
仓库名为:<Github账号名称>.github.io
勾选 Initialize this repository with a README
添加SSH秘钥
- 设置Git的user name和email:
git config --global user.name "your name"
git config --global user.email "your email"
- 打开Git Bash,输入以下命令,回车三次
ssh-keygen -t rsa -C "your email"
打开github,登录,添加的是“id_rsa.pub”(C:\Users\Administrator.ssh\id_rsa.pub)里面的公钥.
- 测试SSH是否成功
ssh -T git@github.com
yes
如果提示:Hi XXX ,You’ve successfully authenticated, but GitHub does not provide shell access. 说明你连接成功了
- 修改_config.yml(配置文件)
deploy:
type: git
repo: git@github.com:你的github账号名称/你的github账号名称.github.io.git
branch: master
- 如果你有Coding账号
添加ssh
创建仓库 仓库名称是你coding账号名称
点击Page服务,勾选 一键开启静态 Pages
deploy:
- type: git
repo: git@github.com:你的github账号名称/你的github账号名称.github.io.git
branch: master
- type: git
repo: git@git.dev.tencent.com:你的coding账号名称/你的coding账号名称.git
branch: master
- 安装部署插件
npm install hexo-deployer-git --save
- 部署
hexo clean
hexo g
hexo d
hexo clean : 清除缓存
hexo g : 重新生成代码
hexo d : 部署
- 访问
https://<Github账号名称>.github.io
https://<Coding账号名称>.coding.me
主题优化
- Hexo themes 官网
- Next主题
cd <folder>
git clone https://github.com/iissnan/hexo-theme-next themes/next
- 修改_config.yml
theme: next
-
NexT个性化设置
NexT官网- 修改\themes\next_config.yml
#scheme: Muse scheme: Mist #scheme: Pisces #scheme: Gemini
-
部署
hexo clean
hexo g
hexo d
- 博客
我的hexo博客