# hexo **Repository Path**: qinkunwei/hexo ## Basic Information - **Project Name**: hexo - **Description**: hexo博客 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2019-09-10 - **Last Updated**: 2023-09-07 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # hexo #### 介绍 博客 #### Hexo基本使用 1. 简述 Hexo是一个基于Node.js的博客系统,常用于搭建在GitHub上。 其本质其实是一个基于Node.js的内嵌webserver的程序,可以通过一些命令根据markdown生成静态页面,这些页面既可以部署到本地内嵌的webserver上,也可以部署到GitHub上(配置和命令)。 2. 准备Git客户端和GitHub 安装Git客户端或TortoiseGit 注册GitHub 创建一个仓库,仓库命名必须为用户名.github.io,因为全部步骤完成后你就可以通过https://用户名.github.io来访问你的博客了~ 配置SSH * 打开Git Bash,设置用户名($ git config --global user.name "你的GitHub用户名")和邮箱($ git config --global user.email "你的GitHub注册邮箱") * 生成ssh密钥:$ ssh-keygen -t rsa -C "你的GitHub注册邮箱",此时在用户文件夹下就会有一个新的文件夹.ssh,其中id_rsa文件是私钥,要妥善保管,id_rsa.pub是公钥文件 * 添加ssh密钥到GitHub:在Settings->SSH and GPG keys下,新建一个ssh key,将id_rsa.pub中的内容复制到Key文本框中 * 测试ssh:$ ssh -T git@github.com 3. 安装配置Hexo 从官网安装Node.js 安装Hexo:npm install hexo-cli -g 初始化Hexo:hexo init 安装依赖:npm install 启动Hexo:hexo server,启动后可以在浏览器中使用http://localhost:4000访问本地webserver(已自动根据现有文章生成静态页面) 4. 集成Hexo与GitHub 认证已通过前面的ssh实现 编辑Hexo配置文件_config.yml,添加github仓库信息(注意type、repo、branch的前面有两个空格,后面的:后面有一个空格): ``` # Deployment ## Docs: https://hexo.io/docs/deployment.html deploy: type: git repo: git@github.com:wangyeping1988/wangyeping1988.github.io.git #github仓库地址 branch: master # github分支 ``` 安装Git插件:npm install hexo-deployer-git --save 5. 日常使用 新建文章(可以用双引号括起来):hexo new 然后在source文件夹下就生成了对应的md文件,就可以直接去编辑了 生成静态页面:hexo generate 清除生成内容:hexo clean 部署到GitHub:hexo deploy #### 参与贡献 1. Fork 本仓库 2. 新建 Feat_xxx 分支 3. 提交代码 4. 新建 Pull Request #### 码云特技 1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md 2. 码云官方博客 [blog.gitee.com](https://blog.gitee.com) 3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解码云上的优秀开源项目 4. [GVP](https://gitee.com/gvp) 全称是码云最有价值开源项目,是码云综合评定出的优秀开源项目 5. 码云官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) 6. 码云封面人物是一档用来展示码云会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)