大佬推荐把博客部署在coding上,毕竟github在国外访问比较慢

参考玩转hexo-3-部署

创建项目

注册并新建项目

官网链接:coding

新建项目

新建项目


基本配置

基本配置

分支管理

选择分支

选择分支

新建分支

新建分支

创建分支

创建分支

修改默认分支

修改默认分支

选择新建的分支

选择新建的分支

启动page服务

选择page服务

选择page服务

选择master分支

选择master分支


通过git完成部署

修改部署路径

将之前的github注释掉,添加coding的deploy

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# Deployment
## Docs: https://hexo.io/docs/deployment.html
#deploy:
#type: git
#repository: git@github.com:YuanLiChenAi/YuanLiChenAi.github.io.git
#branch: master
deploy:
- type: git
repo: git@git.coding.net:YuanLiChenAi/YuanLiChenAi.git # 后面为:你的账号/刚才创建的仓库名.git
branch: master
- type: git
repo: git@git.coding.net:YuanLiChenAi/YuanLiChenAi.git # 后面为:你的账号/刚才创建的仓库名.git
branch: src
extend_dirs: /
ignore_hidden: false
ignore_pattern:
public: .
.git: .

coding有两个分支,master用来部署网站,src用来备份网站源文件
效果如下:

master保存静态html

master保存静态html


src分支保存源文件

src分支保存源文件




因为我是从github切换到coding的,所以目录下中含有.git隐藏目录
如果直接部署,则会报错。所以要在博客目录中用rm -rf .git命令来删除这个目录
删除之后就可以顺利部署了,而且不用再用git push ...备份了

特别注意