1.git bash
2.nodejs
3.安装hexo
创建一个文件夹blog
,cd
到此目录下:
mkdir blog
cd blog
进行全局安装,查看版本
cnpm install hexo-cli -g
hexo -v

4.githubPages搭建
创建仓库,名为 yourname.github.io

配置github账户信息
git config --global user.name "name"
git config --global user.email "email"
创建ssh
ssh-keygen -t rsa -C "youremail@xx.com"
cd ~/.ssh
cat id_rsa.pub
此时即获取到ssh

然后将上边获取到的ssh放入github的settings

验证ssh
ssh -T git@github.com
出现如下内容即成功,首次需要你输入yes同意

5.修改hexo默认配置
在_config.yml
中,添加配置,其他内容自行修改
deploy:
type: git
repo: https://github.com/YourgithubName/YourgithubName.github.io.git
branch: master
如果想查看博客的展示需要安装yarn add hexo-server
hexo clean
hexo generate
hexo server
即可在 http://localhost:4000
访问了
6.上传github
hexo clean
hexo generate
hexo deploy
可以直接使用 hexo clean && hexo g && hexo d 进行发布
网友评论