#mark下操作步骤(windows):
-
环境准备:
包括git、node.js、npm设置淘宝镜像 -
初始化博客
#!bash $ cnpm install hexo-cli -g $ hexo init blog $ cd blog $ cnpm install $ hexo g # 或者hexo generate $ hexo s # 或者hexo server,可以在http://localhost:4000/ 查看 -
git设置publicKey
git bash中生成publicKey
$ ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
找到公钥文件id_rsa.pub,默认目录为C:/Users/[username]/.ssh,用文本编辑器打开并复制
然后打开github网站,可以将公钥添加为项目公钥也可以添加为账户公钥添加为项目公钥步骤:进入项目点击Settings->Deploy keys->Add Deploy key.
具体可以参考:Generating a new SSH key and adding it to the ssh-agent -
提交部署
安装hexo-deployer-git
$ npm install hexo-deployer-git --save
修改配置(冒号后面一定要跟空格)
deploy:
type: git
repo: git@github.com:nanacoding/nanacoding.github.io.git
branch: master
部署到github,在git bash中执行 hexo d(publicKey只有在git bash中有效)