一、默认你已经配置好以下环境:
1.github;
2.编辑器;
3.git bash;
4.npm;
5.node.js;
二、主要是在github和git bash中操作,因此再分为两大块:
github中:
1.登录你的github,新建一个空仓库(repo),repo名称为:zhangsan.github.io(如果你不叫zhangsan,请改为你自己的名字);
2.什么都不要动,直接点击绿色的按钮:create repository;
3.新建成功以后,页面上出来一堆你看不懂的东西,在显眼处你看到HTTPS和SSH右边白色的框里面有堆地址的时候,恭喜你,你找到了你的仓库地址,最好使用SSH(当然了你需要配置好SSH KEY)而不要使用HTTPS([email protected]:开头的哦);
4.在第二大段文字中,…or create a new repository on the command line,下面所有的命令行,在git bash中运行一遍,依次运行,就是一行一行的复制,粘贴,回车;
5.点击settings,一直往下拉,知道看到GitHub Pages,在source下方,点击选择master branch,然后保存,你就打开了github page功能啦,上方对号旁边的地址就可以直接预览了,可以保存下。
git bash中有以下操作:
1.进入一个安全的你能找得到的目录,比如cd ~/Desktop;
2.输入命令行:npm install -g hexo-cli,按回车(安装 Hexo);
3.输入:hexo init myBlog(新建一个名为myBlog的网站),按回车;
4.输入:cd myBlog(进入myBlog目录),按回车;
5.输入:npm i(insert),按回车;
6.hexo new 开博啦(新建一篇名为“开博啦”的文章),按回车;
7.找到你的开博啦.md文件,用编辑器打开,随便写一些你能记住的内容。如果你的myBlog就在桌面上,那么你的md文件目录是在myBlog/source/_posts/开博啦.md;
8.在git bash输入命令行:start _config.yml,编辑网站配置:
a.把第 6 行的 title 改成你这边文章的主标题;
b.把第 9 行的 author 改成你的名字;
c.把最后一行的 type 改成 type: git,注意:type冒号空格git;
d.在最后一行后面新增一行,左边与 type 平齐,加上一行 repo: 仓库地址,注意:repo冒号空格仓库地址;
9.在git bash中输入:npm install hexo-deployer-git –save,安装 git 部署插件;
10.输入:hexo deploy,回车,注意每次输入命令行之后都要按回车;
11.进入zhangsan.github.io对应的repo,你改为你自己名字了的自己找;
12.github部分中的最后一步,点击链接,就可以看到你的博客啦!
Hello World
Veröffentlicht am
Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.
Quick Start
Create a new post
1 | $ hexo new "My New Post" |
More info: Writing
Run server
1 | $ hexo server |
More info: Server
Generate static files
1 | $ hexo generate |
More info: Generating
Deploy to remote sites
1 | $ hexo deploy |
More info: Deployment