hexo搭建
Hexo搭建
1、安装Node.js
建议使用 Node.js 10.0 及以上版本,最新版本貌似和hexo5有冲突。
一路next傻瓜操作
2、安装hexo
cmd输入
1 | npm install -g hexo-cli |
3、建站
Github Page配置参见官网:https://pages.github.com/
记得本地hexo仓库要关联到github page
1 | git remote add origin github.com/你的github名字/你的github名字.github.io.git |
新建hexo文件夹,打开git bash,一步步输入
1 | //初始化 |
大功告成,放个鞭炮庆祝下吧!
编写博客
进入hexo文件夹,打开git bash输入
1 | hexo new post XXX |
会在source文件中生成XXX.md,通过Typora打开编辑
1 | hexo g |
生成并发布
外网 :https://你的github名字.github.io/
我的:cooper12138.github.io/
配置主题
用我的主题为例:butterfly
进入hexo文件夹,打开git bash
1 | git clone -b master https://github.com/jerryc127/hexo -theme -butterfly .git themes/butterfly |
把下载下来的文件名改成butterfly,并剪切到Hexo\themes文件夹中
修改站点配置文件_config.yml,把主题改为butterfly
1 | theme: butterfly |
安装插件
1 | npm install hexo -renderer -pug hexo -renderer -stylus - -save |
各种疑难杂症的报错请自行百度!
重启试试,大功告成,放个鞭炮庆祝下吧!
git配置多账号
1、桌面右键打开git bash, 查看全局配置
1 | git config --global --list |
2、为不同账户配置ssh密钥
1 | cd ~/.ssh # cd到当前用户的.ssh文件夹 |
完成后会在~/.ssh / 目录下生成以下文件:
- id_rsa.github
- id_rsa.github.pub
- id_rsa.gitee
- id_rsa.gitee.pub
复制公钥分别在github和gitee中设置
例如:
打开github设置
复制用户ssh文件夹中id_rsa.github.pub文件内容
保存
添加新的私钥
1 | $ ssh-agent bash |
3、进行全局配置
1 | touch ~/.ssh/config |
4、测试链接
1 | $ ssh -T git@github.com |
5、hexo博客仓库
1 | vi .depoly_git/.git/config 增加 |
6、针对不同的本地仓库
增加本地配置,在每个仓库的.git/config
中进行配置不同的用户,以及其他的配置信息
1 | $ git config --local user.name 'github/gitee账号名' |
–global是在全局配置文件中设置
–local 是针对当前仓库的项目进行设置
完工!
评论