通过腾讯云cloudstudio免费搭建hexo博客图文教程

Hexo可以搭建在本地或者是服务器里,本地搭建的教程百度有很多,今天分享一种云端搭建的教程,使用的是腾讯云的良心产品cloudstudio,可以实现一个免费的服务器。下面虾皮路就转载一篇很不错的技术文章,通过腾讯云cloudstudio免费搭建hexo博客图文教程。

通过腾讯云cloudstudio免费搭建hexo博客图文教程插图

第一步:注册

注册这一步的教程就省略了,自己注册了。

第二步:创建工作空间

1、 点击新建空间
2、 填写空间名称
3、 运行环境选择node.js(因为hexo博客前提条件是需要安装node.js和git)
4、 代码来源选择无
5、 点击创建
6、 点击创建好的工作空间进入

通过腾讯云cloudstudio免费搭建hexo博客图文教程插图1
通过腾讯云cloudstudio免费搭建hexo博客图文教程插图2

第三步:安装HEXO

进入以后后台是下面这个样子

通过腾讯云cloudstudio免费搭建hexo博客图文教程插图3
通过腾讯云cloudstudio免费搭建hexo博客图文教程插图4
  1. 点击菜单栏中的终端—新建终端
  2. 依次输入命令
    • npm install hexo-cli -g
    • hexo init blog
    • cd blog
    • npm install
    • hexo server
通过腾讯云cloudstudio免费搭建hexo博客图文教程插图5
通过腾讯云cloudstudio免费搭建hexo博客图文教程插图6
  1. 到这里博客已经安装成功了,接下来。我们生成静态文件并部署。

第四部:部署

  1. 点击https://coding.net进入工作台
  2. 按下图步骤创建项目选择代码托管项目
  3. 填写项目名称和项目标识后点击完成创建
通过腾讯云cloudstudio免费搭建hexo博客图文教程插图7
通过腾讯云cloudstudio免费搭建hexo博客图文教程插图8
通过腾讯云cloudstudio免费搭建hexo博客图文教程插图9
  1. 创建完成后点击代码仓库—新建代码仓库—填写仓库名称—点击确认
通过腾讯云cloudstudio免费搭建hexo博客图文教程插图10
通过腾讯云cloudstudio免费搭建hexo博客图文教程插图11
  1. 复制仓库地址
通过腾讯云cloudstudio免费搭建hexo博客图文教程插图12
通过腾讯云cloudstudio免费搭建hexo博客图文教程插图13

6.回到刚刚的工作空间点击_config.yml

  1. 拉倒代码最下方,修改以下代码
    deploy:
    type: git
    repo: [email protected]:chensu/11/blog.git,master
通过腾讯云cloudstudio免费搭建hexo博客图文教程插图14
  1. 回到终端输入hexo g -d ,出现错误,输入如下代码
    git config --global user.email "你的邮箱"
    git config --global user.name "你的名字"
通过腾讯云cloudstudio免费搭建hexo博客图文教程插图15
  1. 完成后再次输入hexo g -d 成功推送
通过腾讯云cloudstudio免费搭建hexo博客图文教程插图16
  1. 回到代码仓库,刷新一下,代码已经推送过来了。
通过腾讯云cloudstudio免费搭建hexo博客图文教程插图17

11.接下来生成静态网站,点击左下角项目设置—功能开关—打开持续部署,然后返回。

  1. 点击持续部署—静态网站—新建静态网站
通过腾讯云cloudstudio免费搭建hexo博客图文教程插图18
通过腾讯云cloudstudio免费搭建hexo博客图文教程插图19
  1. 完成后coding会自动部署,只需等待即可,大概需要40秒左右的时间就会部署成功。
通过腾讯云cloudstudio免费搭建hexo博客图文教程插图20
通过腾讯云cloudstudio免费搭建hexo博客图文教程插图21

总结

中间漏了一个步骤

  1. 在通过git推送代码之前需要先添加一下秘钥,先在终端输入代码

ssh-keygen -t rsa -C "你的邮箱"

然后直接三个回车即可,默认不需要设置密码,生成ssh密钥文件成功

  1. 接着输入 cat ~/.ssh/id_rsa.pub 来获取秘钥
  2. 添加到coding中
通过腾讯云cloudstudio免费搭建hexo博客图文教程插图22

 收藏 (0) 更新不易,打赏吧

您可以选择一种方式赞助本站

支付宝扫一扫赞助

微信钱包扫描赞助

除特别注明外,本站所有文章均基于CC-BY-NC-SA 4.0原创,转载请注明出处。
文章名称:《通过腾讯云cloudstudio免费搭建hexo博客图文教程》
文章链接:https://www.xiapilu.com/web/web-tutorial/cloudstudio-hexo.html
分享到: 生成海报

评论 抢沙发

评论前必须登录!

立即登录   注册

切换注册

登录

忘记密码 ?

切换登录

注册

我们将发送一封验证邮件至你的邮箱, 请正确填写以完成账号注册和激活