我所用的系统环境为deepin15.5,已经安装好Git。先检查电脑是否已经安装SSH:
ls -al ~/.ssh
, 若是有id_rsa(私钥),id_rsa_pub(公钥)文件就表示安装好了。测试一下:ssh -T git@github.com
html
装Hexo须要安装Node.js、Git ,安装Node.js,下面是使用nvm安装的方法:
wget -qO- https://raw.github.com/creationix/nvm/master/install.sh | sh
安装完成后,重启终端并执行命令npm instal stable
便可安装 Node.js。git
使用npm install -g hexo-cli
安装Hexogithub
使用git clone git@github.com:USERNAME/USERNAME.github.io.git
拷贝仓库,此时为默认分支hexonpm
USERNAME.github.io.git目录通常有.gtik、_comfig.yml和index.md,把.git文件复制出来,删除掉 _comfig.yml和index.md文件。此时USERNAME.github.io.git目录为空,执行hexo init
(创建博客所需的文件)、npm install
(安装依赖包),把以前复制出来.git文件黏贴回去进行覆盖segmentfault
到这里,Hexo博客已经搭建好了本地的服务,执行命令
hexo g
和hexo s --debug
在浏览器中输入localhost:4000就能够看到博客主页了浏览器
#Deployment ##Docs: https://hexo.io/docs/deployment.html deploy: type: git repository: https://github.com/USERNAME/USERNAME.github.io branch: master
为了可以使Hexo部署到GitHub上,须要安装一个插件:缓存
npm install hexo-deployer-git --save
markdown
平时工做都是在分支hexo,并不影响部署。执行命令hexo g -d
在浏览器输入USERNAME.github.io ,便可看到博客首页hexo
git status #查看本地文件的状态 git add . #将全部更新的本地文件添加到版本控制系统中 git commit -m '更新信息说明' #提交 git push origin hexo #推送到远程仓库
同步源码到其余电脑框架
npm install hexo
,使用git clone git@github.com:USERNAME/USERNAME.github.io.git
拷贝仓库,默认分支为hexo,在USERNAME.github.io.git目录下执行下面代码:npm install npm install hexo-deployer-git --save
使用其余主题的方法:
$ cd USERNAME.github.io #你的根目录 $ git clone https://github.com/theme-next/hexo-theme-next themes/next
## Themes: https://hexo.io/themes/ theme: next
记录类型 | 主机记录 | 解析线路 | 记录值 |
---|---|---|---|
CNAME | www | 默认 | USERNAME.github.io |
CNAME | @ | 默认 | USERNAME.github.io |
参考资料:
http://theme-next.iissnan.com/getting-started.html
http://codepub.cn/2016/03/20/Hexo-blog-theme-switching-from-Jacman-to-NexT-Mist/
http://www.javashuo.com/article/p-ytqlnroo-nh.html
http://www.javashuo.com/article/p-asgsqgka-ch.html
http://shenzekun.cn/hexo%E7%9A%84next%E4%B8%BB%E9%A2%98%E4%B8%AA%E6%80%A7%E5%8C%96%E9%85%8D%E7%BD%AE%E6%95%99%E7%A8%8B.html