set-up-personal-blog-on-GitHub
准备
GitHub
账号、Ubuntu
系统
安装git
1 | sudo apt-get install git |
配置账户信息
1 | git config --global user.email "you@example.com" # 你在GitHub上注册的email |
check this: https://git-scm.com/book/zh/v2/%E8%B5%B7%E6%AD%A5-%E5%AE%89%E8%A3%85-Git
安装NodeJS
1 | wget -qO- https://raw.github.com/creationix/nvm/master/install.sh | sh |
安装完成后,重启终端
并执行下列命令。
1 | export NVM_NODEJS_ORG_MIRROR=https://npm.taobao.org/mirrors/node |
check this: https://hexo.io/zh-cn/docs/index.html
建站
1 | hexo init hexo # if error, check this: https://github.com/hexojs/hexo/issues/580 |
check this: https://hexo.io/zh-cn/docs/setup.html
安装NexT主题
1 | cd hexo |
check this: http://theme-next.iissnan.com/getting-started.html
创建GitHub仓库
仓库名必须为:你的GitHub账号名.github.io
得到生成的仓库的链接,如:https://github.com/aeiouaoeiuv/aeiouaoeiuv.github.io.git
hexo部署
先修改_config.yml
,修改如下:
1 | deploy: |
然后执行如下命令:
1 | cd hexo |
输入账号和密码,稍等片刻即可通过 你的账号名.github.io
访问博客了。
check this: https://hexo.io/zh-cn/docs/deployment.html#Git
换电脑怎么办?
在GitHub上新建一个repository,名为 hexo
,拷贝该url
在ubuntu上clone该repository,如: git clone git@github.com:aeiouaoeiuv/hexo.git hexo.git
然后把你的 hexo
里所有文件拷贝至该 hexo.git
目录,如: cp -rf hexo/* hexo.git
然后执行如下命令:
1 | cd hexo.git |
新电脑操作步骤
1 | git clone git@github.com:aeiouaoeiuv/hexo.git hexo.git |
以后写文章步骤
1 | cd hexo.git |
git官方文档:https://git-scm.com/book/zh/v2
hexo官方文档:https://hexo.io/zh-cn/docs/NexT主题官方文档:http://theme-next.iissnan.com/getting-started.html
NexT主题官方文档:https://theme-next.js.org/docs/