怎么安装hexo通过命令窗口将本地文件推到github

1.hexo是基于node和git,因此要先下载node.js和git,安装好后,在命令窗口下载npm包管理工具,窗口命令为:npm install -g hexo --registry=https://registry.npm.taobao.org(此为淘宝镜像代理的仓库,下载速度比较快)

2.创建一个空文件夹,名字随便,右键点击空白处,点git bash here 运行:hexo init 命令。意思是博客系统的初始化,如果初始化失败,提示需要运行npm install,那么就把原先空文件夹里的文件删掉,接着运行hexo init --npm install,

3.source_posts md文档就是博客文档,如果要写一篇博客(新建文件 xxx.md)想要把md文档转html文件 运行:hexo g

4.在自己的服务器预览 运行:hexo s,一般地址为 localhost:4000 如果没有提示成功,那么运行:npm install server --save 安装命令

5.如果从新生成html文件可能会有缓存 ,想要清除缓存运行:hexo clean命令

6.怎么和github关联 推代码到github上呢?

7.和git关联 运行:npm install hexo-deployer-git --save命令,安装hexo-deploy-git 插件

8.和github关联需要配置文件

9.修改文件 _config.yml 在最下面
type: git
repo: [email protected]:用户名/用户名.github.io.git
branch: master
10. 需要在github配置仓库,如果 没有github账号就先创建账号,接着在右上角点击your repository ,然后new一个repository名称是 用户名.github.io
11. 把代码推到github 运行命令 :hexo d

  1. 在仓库的首页 settings—>GitHub Pages–>改选项 Source(none—master branch)

  2. 通过 用户名.github.io 访问你的博客

猜你喜欢

转载自blog.csdn.net/weixin_44442095/article/details/86064275
今日推荐