hexo搭建
hexo搭建
安装环境
nodejs,git安装
此处不举例,自行百度hexo-cli安装
npm install -g hexo-cli
特定文件夹初始化hexo
$hexo init
或者npm install hexo --save
1
2
3
4
5
6
7
8
9
10
11
12
13
14 >># 安装插件
>>npm install hexo-generator-index --save
>>npm install hexo-generator-archive --save
>>npm install hexo-generator-category --save
>>npm install hexo-generator-tag --save
>>npm install hexo-server --save
>>npm install hexo-deployer-git --save
>>npm install hexo-deployer-heroku --save
>>npm install hexo-deployer-rsync --save
>>npm install hexo-deployer-openshift --save
>>npm install hexo-renderer-marked --save
>>npm install hexo-renderer-stylus --save
>>npm install hexo-generator-feed --save
>>npm install hexo-generator-sitemap --save
Git配置多个SSH-Key
当有多个git账号时,比如:
a. 一个gitee,用于公司内部的工作开发;
b. 一个github,用于自己进行一些开发活动;
解决方法
生成一个公司用的SSH-Key
$ ssh-keygen -t rsa -C '174499700@qq.com' -f ~/.ssh/gitee_id_rsa
生成一个github用的SSH-Key
ssh-keygen -t rsa -C 'benguahao@foxmail.com' -f ~/.ssh/github_id_rsa
在 ~/.ssh 目录下新建一个config文件,添加如下内容(其中Host和HostName填写git服务器的域名,IdentityFile指定私钥的路径)
1
2
3
4
5
6
7
8
9
10# gitee
Host gitee.com
HostName gitee.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/gitee_id_rsa
# github
Host github.com
HostName github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/github_id_rsa
如果源的网速不好
可以更换淘宝源:npm install -g cnpm --registry=https://registry.npm.taobao.org
把npm命令替换使用cnpm命令
修改配置文件
1 | # Hexo Configuration |
发布部署
1 | # 编译 |
修改主题和配置配置文件
安装主题NexT
ps: 我们现在在目录hexo下
git clone https://github.com/next-theme/hexo-theme-next themes/next
并在目录hexo下的_config.yml中找到 theme: 修改后面的参数,默认是 landscape
theme: next
克隆慢问题解决
修改/etc/hosts文件 ,加入两行
1
2151.101.72.249 http://global-ssl.fastly.Net
192.30.253.112 http://github.com
参考文档
- https://www.jianshu.com/p/0823e387c019
- https://gitee.com/help/articles/4229