Github+Hexo搭建个人Blog
2017-11-13 23:35
260 查看
Github+Hexo搭建个人Blog
GithubHexo搭建个人Blog一Hexo本地搭建
二Github设置
三将本地部署的Hexo发布到Github上
一、Hexo本地搭建
搭建环境操作系统:win10 x64
nodejs:https://nodejs.org/en/
Git for Windows:https://git-for-windows.github.io/
下载当前稳定版本并安装,安装完毕后查看相应版本检测是否成功
安装hexo
输入安装命令
npm install -g hexo
出现如下图所示信息,安装一直等待无进度
因为默认的nodejs的npm安装源为国外的地址,一直访问不到,修改npm registry为国内地址即可
npm config get registry
npm config set registry https://registry.npm.taobao.org –global
npm config set disturl https://npm.taobao.org/dist –global
安装完毕,查看是否安装成功
hexo -v
本地运行hexo
新建一空文件夹,用于部署hexo网站代码,在文件夹上右键运行Git Bash,进入bash界面,输入hexo init 新建网站
查看项目文件夹下生成的文件目录
本地运行网站
hexo s
在浏览器中输入http://localhost:4000即可访问初始化的网站
二、Github设置
申请github账号,按照提示自行申请登陆创建仓库,仓库名称必须为(github账号名).github.io
配置本地电脑SSH到Github
在git bash中输入 ssh-keygen -t rsa -C “897221533@qq.com”创建密钥,按照默认提示,回车即可,完成后,可在用户目录下看到如下文件
用记事本打开id_rsa.pub,复制里面的key
在github主页,个人设置->settings->SSH and GPG keys->New ssh key,粘贴复制的key,保存
测试github的ssh设置是否成功
ssh -T git@github.com
配置git信息
git config –global user.name “bluemooder” # github用户名
git config –global user.email “897221533@qq.com” #github注册邮箱
git config –list #查看
三、将本地部署的Hexo发布到Github上
修改网站配置文件_config.yml# Site title: 运维艄公 subtitle: description: 运维是条长河,我愿作河中的艄公 author: bluemooder language: zh-CN timezone: Asia/Shanghai # Extensions ## Plugins: https://hexo.io/plugins/ ## Themes: https://hexo.io/themes/ theme: next # Deployment ## Docs: https://hexo.io/docs/deployment.html deploy: type: git repo: git@github.com:bluemooder/bluemooder.github.io.git branch: master
注意:配置文件中使用中文时,一定要将编辑器的字符集改为utf-8,不然会出现乱码
repo的地址是在github上配置的仓库地址
2. 设置主题
上面配置文件已将主题设置为next,这个主题简洁大方,使用者最多,需要将主题相关代码下载到本地
git clone https://github.com/iissnan/hexo-theme-next themes/next
注意:博客使用的是中文,next主题默认是英文的,需要将next主题文件夹中的中文语音包更改为上面配置文件的名字,即将next文件夹language中的zh-Hans.yml 重命名 zh-CN.yml,否则会出现乱码
3. 用git bash在项目目录下生成本地文件,目录并部署到github上
注意:因为使用的是git部署,需要提前安装git扩展,否则会报错:deloyer not found:git
npm install hexo-deployer-g
4000
it –save
hexo g -d
部署成功后,即可使用https://bluemooder.github.io访问网站了
参考网站:http://www.jianshu.com/p/62106cb9370e
http://blog.csdn.net/qqduxingzhe/article/details/72629278
相关文章推荐
- Github + Hexo 搭建个人Blog(一)Github搭建Blog
- Github + Hexo 搭建个人Blog(二)Hexo工具使用
- 利用Hexo在GitHub搭建个人的Blog
- 基于Github&Hexo的个人博客搭建过程
- github+hexo搭建个人博客
- [日常记录] hexo+github 搭建Blog
- 一步步教你使用Hexo配合github搭建个人主页
- 用Hexo-GithubPages-CodingPages搭建自己的个人博客
- 使用 GitHub+Hexo 搭建个人博客
- 个人搭建hexo并部署到github期间遇到的问题
- Hexo+GitHub 搭建静态个人博客
- GitHub+Hexo搭建个人静态博客
- github+hexo+node.js搭建个人博客基本过程及遇到的问题
- 使用GitHub + Hexo搭建个人博客(三)- npm(Node Packaged Modules)
- 使用GitHub + Hexo搭建个人博客(七)- 基本配置
- 使用hexo+github搭建免费个人博客详细教程
- github+hexo搭建个人博客
- Github Pages 搭建HEXO主题个人博客
- github + Hexo 搭建你的个人博客
- 为什么写博客,如何使用GithubPages+hexo搭建个人博客站点