为了更好的阅读体验,请访问个人博客地址:
https://xiuxiuing.gitee.io/blog/2018/08/08/giteepage/

为何使用Gitee而不是GitHub

目前国内访问GitHub速度慢,还可能被墙,所以Gitee来构建个人博客。Gitee类似国内版的GitHub,访问速度有保证。

环境要求

  • Git
  • NodeJs
    默认你已经安装了Git和NodeJS(推荐使用cnpm)

开始搭建

1. 安装Hexo

打开 shell 终端,输入命令`npm install -g hexo`
$ sudo cnpm install -g hexo
Password:
Downloading hexo to /usr/local/lib/node_modules/hexo_tmp
Copying /usr/local/lib/node_modules/hexo_tmp/_hexo@3.7.1@hexo to /usr/local/lib/node_modules/hexo
Installing hexo's dependencies to /usr/local/lib/node_modules/hexo/node_modules
[1/27] abbrev@^1.0.7 installed at node_modules/_abbrev@1.1.1@abbrev
[2/27] archy@^1.0.0 installed at node_modules/_archy@1.0.0@archy
[3/27] hexo-i18n@^0.2.1 installed at node_modules/_hexo-i18n@0.2.1@hexo-i18n
[4/27] js-yaml@^3.6.1 existed at node_modules/_js-yaml@3.12.0@js-yaml
[5/27] bluebird@^3.4.0 installed at node_modules/_bluebird@3.5.1@bluebird
[6/27] chalk@^2.3.1 installed at node_modules/_chalk@2.4.1@chalk
[7/27] hexo-front-matter@^0.2.2 installed at node_modules/_hexo-front-matter@0.2.3@hexo-front-matter
[8/27] minimatch@^3.0.4 installed at node_modules/_minimatch@3.0.4@minimatch
[9/27] pretty-hrtime@^1.0.2 installed at node_modules/_pretty-hrtime@1.0.3@pretty-hrtime
[10/27] hexo-util@^0.6.3 installed at node_modules/_hexo-util@0.6.3@hexo-util
[11/27] hexo-cli@^1.1.0 installed at node_modules/_hexo-cli@1.1.0@hexo-cli
[12/27] resolve@^1.5.0 installed at node_modules/_resolve@1.8.1@resolve
[13/27] strip-indent@^2.0.0 installed at node_modules/_strip-indent@2.0.0@strip-indent
[14/27] strip-ansi@^4.0.0 installed at node_modules/_strip-ansi@4.0.0@strip-ansi
[15/27] text-table@^0.2.0 installed at node_modules/_text-table@0.2.0@text-table
[16/27] tildify@^1.2.0 existed at node_modules/_tildify@1.2.0@tildify
[17/27] titlecase@^1.1.2 installed at node_modules/_titlecase@1.1.2@titlecase
[18/27] moment@^2.19.4 installed at node_modules/_moment@2.22.2@moment
[19/27] moment-timezone@^0.5.14 installed at node_modules/_moment-timezone@0.5.21@moment-timezone
[20/27] hexo-log@^0.2.0 installed at node_modules/_hexo-log@0.2.0@hexo-log
[21/27] swig-extras@0.0.1 installed at node_modules/_swig-extras@0.0.1@swig-extras
[22/27] lodash@^4.17.5 installed at node_modules/_lodash@4.17.10@lodash
[23/27] cheerio@0.22.0 installed at node_modules/_cheerio@0.22.0@cheerio
fsevents@1.2.4 download from binary mirror: {"module_name":"fse","module_path":"./lib/binding/{configuration}/{node_abi}-{platform}-{arch}/","remote_path":"./v{version}/","package_name":"{module_name}-v{version}-{node_abi}-{platform}-{arch}.tar.gz","host":"https://cdn.npm.taobao.org/dist/fsevents"}
[24/27] nunjucks@^3.1.2 installed at node_modules/_nunjucks@3.1.3@nunjucks
[25/27] swig-templates@^2.0.2 installed at node_modules/_swig-templates@2.0.2@swig-templates
[26/27] hexo-fs@^0.2.0 installed at node_modules/_hexo-fs@0.2.3@hexo-fs
[27/27] warehouse@^2.2.0 installed at node_modules/_warehouse@2.2.0@warehouse
execute post install 2 scripts...
[1/2] scripts.postinstall nunjucks@^3.1.2 run "node postinstall-build.js src"
[1/2] scripts.postinstall nunjucks@^3.1.2 finished in 109ms
[2/2] scripts.install hexo-fs@0.2.3 › chokidar@1.7.0 › fsevents@^1.0.0 run "node install"
[fsevents] Success: "/usr/local/lib/node_modules/hexo/node_modules/_fsevents@1.2.4@fsevents/lib/binding/Release/node-v64-darwin-x64/fse.node" already installed
Pass --update-binary to reinstall or --build-from-source to recompile
[2/2] scripts.install hexo-fs@0.2.3 › chokidar@1.7.0 › fsevents@^1.0.0 finished in 306ms
deprecate titlecase@^1.1.2 no longer maintained
Recently updated (since 2018-08-01): 1 packages (detail see file /usr/local/lib/node_modules/hexo/node_modules/.recently_updates.txt)2018-08-06→ resolve@1.8.1 › path-parse@^1.0.5(1.0.6) (14:32:36)
All packages installed (280 packages installed from npm registry, used 4s, speed 1.65MB/s, json 236(1.51MB), tarball 5.8MB)
[hexo@3.7.1] link /usr/local/bin/hexo@ -> /usr/local/lib/node_modules/hexo/bin/hexo

注:如果提示权限错误,命令前加sudo,cnpm 是淘宝的开源镜像,国内访问比npm快。

2. 初始化Hexo

在你的电脑上创建Hexo文件夹,在shell终端中切换到Hexo目录,输入命令 hexo init

$ cd /work/Hexo
/work/Hexo $ hexo init
INFO  Cloning hexo-starter to /work/Hexo
Cloning into '/work/Hexo'...
remote: Counting objects: 65, done.
remote: Total 65 (delta 0), reused 0 (delta 0), pack-reused 65
Unpacking objects: 100% (65/65), done.
Submodule 'themes/landscape' (https://github.com/hexojs/hexo-theme-landscape.git) registered for path 'themes/landscape'
Cloning into '/work/Hexo/themes/landscape'...
^Cwarning: Clone succeeded, but checkout failed.
You can inspect what was checked out with 'git status'
and retry the checkout with 'git checkout -f HEAD'INFO  See you again

初始化完成后Hexo的目录结构:

3. 获取博客主题

在shell中输入命令:git clone https://gitee.com/xiuxiuing/hexo-theme-even themes/even

/work/Hexo $ git clone https://gitee.com/xiuxiuing/hexo-theme-even themes/even
Cloning into 'themes/even'...
remote: Counting objects: 136, done.
remote: Compressing objects: 100% (123/123), done.
remote: Total 136 (delta 4), reused 128 (delta 2)
Receiving objects: 100% (136/136), 264.27 KiB | 556.00 KiB/s, done.
Resolving deltas: 100% (4/4), done.

克隆完成后,在/Hexo/themes目录下,可以看到 landscapeeven 两个文件夹。
我们所要使用的主题都是放在这个目录下,Hexo默认使用的是landscape主题,由于第二步Hexo初始化时主题没有clone成功,所以我们这一步克隆了even主题,接下来会使用even主题进行演示。
想获取更多主题,可在网站:https://hexo.io/themes/ 选择自己喜欢的主题,按照此步的步骤clone下来。

4. _config.yml对博客进行基础配置

_config.yml文件修改,保存

5. 本地预览博客

编译项目,输入命令:hexo g
运行项目,输入命令:hexo s

$ hexo g
INFO  Start processing
INFO  Files loaded in 186 ms
INFO  Generated: archives/2018/08/index.html
INFO  Generated: archives/index.html
INFO  Generated: archives/2018/index.html
INFO  Generated: index.html
INFO  Generated: 2018/08/08/hello-world/index.html
INFO  5 files generated in 242 ms
$ hexo s
INFO  Start processing
INFO  Hexo is running at http://localhost:4000/. Press Ctrl+C to stop.

在浏览器中输入`http://localhost:4000/``就可以看到效果啦

部署博客到Gitee上

1. 创建Gitee账号

到码云:https://gitee.com/ 上申请注册账号,码云类似国内版的GitHub,所以操作界面跟GitHub差不多,多了一些国产化的东西,这里不做更多介绍了,自己研究下。

2. 创建项目


创建完成后,在项目中复制项目地址。

3. 在_config.yml中配置Git

deploy:type: gitrepo: https://gitee.com/xiuxiuing/blog.gitbranch: master

注意:冒号后面一定要有空格,否则不能正确识别。

4. 发布到Gitee

输入命令npm install hexo-deployer-git --save 安装自动部署发布工具
输入命令hexo clean && hexo g && hexo d 发布博客,首次发布需要在shell中输入账号和密码。

5. Gitee Pages设置

在项目的服务中选择Pages选项

选择 master分支,点击 部署/更新

稍等一会儿博客就发布成功啦,访问博客地址:https://xiuxiuing.gitee.io/blog,就可预览在线博客啦!!!
如果博客的样式不对,则需要在_config.yml中配置下博客地址和路径:

url: https://xiuxiuing.gitee.io/blog/
root: /blog

再执行命令hexo clean && hexo g && hexo d 就可以啦。

至此,我们的博客就搭建完成啦!!!
/Hexo/source/_posts目录下就可以写我们的博客啦!!!

个人博客效果参考:https://xiuxiuing.gitee.io/blog/

觉得不错,麻烦帮忙分享给朋友,谢谢各位啦!!!

扫码关注微信公众号,更好的交流

使用Gitee+Hexo搭建高速稳定的个人博客相关推荐

  1. 手把手教你使用hexo搭建属于你的个人博客

    前言 每当看到别人精美的个人博客时,不知你是否有一点点的羡慕.别急,现在我就来手把手教你搭建自己的个人博客. 在技术日趋成熟的今天,有着很多种快速生成博客的框架:Hexo,Jekyll,Wordpre ...

  2. 通过ssh在服务器用Hexo搭建个人网站-blog、博客

    title: 在服务器用Hexo搭建个人网站(blog) date: 2022-10-16 21:58:49 记录在服务器用Hexo搭建个人网站-blog 前言: ​ 之前就听说有同学搭建了自己的个人 ...

  3. Hexo+gitee:30分钟搭建一个自己的个人博客网站 欢迎友链呀<(▰˘◡˘▰)

    Hexo + Gitee 部署自己的个人博客   目前市场上比较火的一些博客框架: Hexo.jekyll.Solo.Halo .gohugo.VuePress.wordpress 等等 ,这些都是开 ...

  4. 使用Hexo在GitHub Pages上搭建部署免费的个人博客网站(上:GitHub搭建)——最详细全面解读教程(没有之一)

    标签:Hexo GitHub使用技巧 博客 网站搭建 点击此处,浏览效果更好 版权声明:本文为博主 @残灯飞雪 的原创文章,欢迎转载,传播知识.著作权归作者所有,商业转载请联系作者获得授权,非商业转载 ...

  5. 手把手教你搭建属于自己的技术博客(小白教程)

    手把手教你搭建属于自己的技术博客 先放上我自己搭建的博客地址 https://sourl.cn/Tbk7yt 这里我使用的是 Hexo 框架 以及 Github pages 进行的搭建 文章目录 手把 ...

  6. Hexo+Buttterly+Github Pages构建个人博客

    How to 创建 this 风格`s Blog ​ 我的博客采用框架是Hexo,主题为Butterfly,评论采用Twikoo,支持音乐播放,还有旁边的这只黑猫看版娘,对于如何构建这些,我会在这篇文 ...

  7. 几天时间【免费】搭建了自己的个人博客,免租服务器,免买域名,真香警告。

    几天时间搭建了自己的个人博客,免租服务器,免买域名,真香警告. 刚花了几天搭建了个网站,先上链接,欢迎来访:染墨小白的博客 现在市面上的博客很多,如CSDN,博客园,简书等平台,可以直接在上面发表,用 ...

  8. 从零开始部署到上线:手把手教你搭建属于自己的个人博客网站!

    博客:其实博客的正式名称是网络日记,见名知意,是使用特定软件在网络上出版发表和张贴个人文章的人,或者是一种由个人管理不定期更新文章的网站. 现在是互联网逐渐发展,已经出现了很多可以供自己写博客的网站, ...

  9. 初学者入门:使用WordPress搭建一个专属自己的博客

    体验简介 阿里云云起实验室提供相关实验资源,点击前往  场景将提供一台基础环境为CentOS 的ECS(云服务器)实例,这台服务器上已经内置LAMP环境.我们将会在这台服务器上安装 WordPress ...

最新文章

  1. Android学习笔记(二三): 多页显示-Flipper的使用
  2. java二叉排序树动态查找表_9.3.1动态查找表—二叉排序树
  3. 通过特殊字符查询所在表 或 存储过程
  4. 梅耶尔被爆7月份便已知用户数据遭窃 SEC或介入调查
  5. Winodows10 安全登录(Administrator账户与Microsoft Account关联
  6. 原生ajax请求的五个步骤
  7. graphql java demo_GraphQL学习,Java简单实现
  8. ECSHOP集成百度ueditor编辑器上传图片到服务器或又拍云(七牛云)
  9. html文件调整表格边框的属性,css怎么设置表格边框?
  10. Spring框架实战入门(超全面,超实用)
  11. 五大主流浏览器和内核
  12. 装系统需不需要格式化系统盘?别再被这些说法骗了!
  13. npm install 报node-sass错误
  14. PPT免费下载网页汇总
  15. 超详细的AD8031ARZ介绍,就在这里
  16. 设计模式之禅-策略模式
  17. 关于win7使用微软MediaCreationdTool平滑升级到win10出现0x80072f8f-0x20000的解决方案
  18. LeetCode-287-寻找重复数
  19. 绿地深蓝机器人_人工智能国家队再获加持,国有世界五百强绿地控股战略投资深兰科技...
  20. iOS学习之iOS沙盒(sandbox)机制和文件操作(一)

热门文章

  1. php--生成excel的个人简历
  2. Flash8-全局变量与局部变量
  3. ChatGPT AI绘图Siri快捷指令,根据描述生成图片
  4. Vhost Architecture
  5. python是神马?
  6. R语言:多个向量合并
  7. JavaScript 学习手册二
  8. mac下配置VSCode的C语言开发环境
  9. java bs设计模式_Java进阶篇设计模式之十三
  10. 星际争霸1没背景音乐的解决办法