# syncblog **Repository Path**: cuberl/syncblog ## Basic Information - **Project Name**: syncblog - **Description**: No description available - **Primary Language**: NodeJS - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2018-08-30 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ## 腾讯云配置 1. 新建一个对象存储的bucket, 选择私有写公有读 2. 对新创建的bucket打开静态网站访问 3. 绑定已备案的域名,可以不要CDN,加CDN应该可以https,但我还没试过 ## Gitee配置 1. 新建一个仓库用于存放文章 2. 设置里面设置webhook,新增一个webhook,内容为`http://{your-ip}:3000/hook` 3. 最好设置密码 ## 环境安装 ```shell # node, npm, git ... # 静态博客生成器 Hexo cnpm install -g hexo-cli # 腾讯云对象存储管理工具 coscmd pip install coscmd ``` ## hexo搭建 在远程服务器上,找一个适当的目录,然后执行: ``` shell hexo init ``` 其中, 目录`source/_posts`即为文章的目录,进入这个目录 ``` shell # 初始化 git git init . # 第一次提交到master git add . git commit -m 'first commit' # 将其与远程master绑定 git remote add origin git@gitee.com:xxx/xxx.git # 推上去 git push ``` ## cosmod配置 新建或者打开配置文件`~/.cos.conf` ```ini [common] secret_id = 此处填入你的secret_id secret_key = 此处填入你的secret_key bucket = 填入{bucket-name}-{appid} region = ap-guangzhou max_thread = 5 part_size = 1 schema = https ``` ## 同步程序的配置 ``` shell git clone ``` 打开`update.sh`,将上述hexo根目录路径填入;再打开`main.js`,将密码填到对应区域,然后执行(需要保证3000端口被防火墙允许): ```shell # 安装依赖 cnpm install # 启动程序 node main.js ``` 此时可以推送新文章到git,然后对应站点即可更新。