GithubHelp home page GithubHelp logo

myblog's Introduction

Hexo博客源文件备份

首先我们假设你已经会使用Hexo搭建自己的博客了 如果有不清楚的同学,请移步官方网站先安装hexo,并学会使用至少

hexo s
hexo g
hexo d

这三个命令~

实现方法:

  • 在Github下创建一个新的repository,取名为myBlog。
  • 在本地创建一个blog文件夹,将你的博客源文件Hexo文件夹放在blog里面。
  • 进入本地的blog文件夹,执行以下命令创建仓库:
git init
  • 设置远程仓库地址,并更新:
git remote add origin https://github.com/yourname/myBlog.git 
git pull origin master
  • 修改.gitignore文件(如果没有请手动创建一个),在里面加入*.log 和 public/ 以及.deploy*/。因为每次执行hexo generate命令时,上述目录都会被重写更新。因此忽略这两个目录下的文件更新,加快push速度。
  • 执行命令以下命令,完成Hexo源码在本地的提交。
git add .
git commit -m "init hexo backup"
  • 执行以下命令,将本地的仓库文件推送到Github。
git push origin master
  • 现在在任何一台电脑上,只需要执行
git clone https://github.com/yourname/myBlog.git 

即可完成将Hexo源文件复制到本地(请将yourname/myBlog.git替换为自己相应的仓库地址。)

  • 在本地编写完博客时,顺次执行以下命令,即可完成Hexo博客源文件的更新同步,保持Github上的hexo源码为最新版本。
git add .
git commit -m "update"
git push origin master
  • 当远程仓库有更新时,执行以下命令,即可同步hexo源文件到本地。
git pull origin master

至此,Hexo源代码文件就完成了同步和更新了。

  • 如果要预览本地的博客,只需要在本地执行
cd ./blog/HEXO
hexo g
hexo s

之后在浏览器里输入 http://127.0.0.1:4000/ 就可以看到自己的博客了。

发带图片博客的方法

  • 把主页配置文件_config.yml 里的post_asset_folder这个选项设置为true
  • npm install hexo-asset-image --save
  • 运行hexo n "xxxx"来生成md博文时,/source/_posts文件夹内除了xxxx.md文件还有一个同名的文件夹
  • 引用图片![你想输入的替代文字](xxxx/图片名.jpg)

myblog's People

Contributors

junior2ran avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.