搭建独立博客

1.github创建仓库

2区域输入xxx.github.io(xxx为github用户名)。

2.配置ssh

下载git,在gitbash中操作

$ cd ~/. ssh 检查本机的ssh密钥

如果提示No such file or directory 说明第一次使用。

$ ssh-keygen -t rsa -c "email address"

后面的回车默认即可。

3.添加ssh到github服务器

找到刚生成的id_rsa.pub,复制里面的所有文本。

打开github官网,右上角头像,setting->ssh and gpg keys->new ssh key

title不填,key内粘贴。

4.测试是否连接成功

$ ssh -T [email protected]

5.完善个人信息

$ git config --global user.name "xxxx"//用户名

$ git config --global user.email "邮箱地址"//填写自己的邮箱

6.安装node.js

7.安装hexo

npm install -g hexo

hexo -v //check

hexo文件夹里找到__config.yml

deploy:
type: git
repo: https://github.com/Ga4ra/Ga4ra.github.io.git

branch: master

deploy:
type: git
repo: https://github.com/Ga4ra/Ga4ra.github.io.git

冒号后面有空格,不要漏了。

安装插件。

$ npm install hexo-deployer-git --save

在想安装的路径右键 git bash

hexo init

hexo g

hexo s

浏览器localhost:4000即可看到默认主页

开始部署

$ hexo g

$ hexo d

搭建独立博客_第1张图片
image

出现这个说明部署成功。

8.绑定域名

9.发文

在Hexo\source_posts创建md文件即可。

可适当清理缓存

$ hexo clean

10.下载主题

$ git clone https://github.com/litten/hexo-theme-yilia.git themes/yilia

在__config.yml里修改theme即可。

你可能感兴趣的:(搭建独立博客)