title: hexo自動部署到git、ftp(虛擬主機等)、雲服務器的方式 tag: hexo,git,ftp,雲服務器
自動部署很有用,當你寫完文章後,直接使用hexo d
就可以自動更新你的網站了
部署到git
首先你需要在你的blog下安裝git deployer插件:
npm install hexo-deployer-git --save
,然後再把如下代碼添加到你的_config.yml文件中### git deploy deploy: type: git repo: https://github.com/cmlanche/cmlanche.github.io.git # 你的遠程倉庫 branch: master # 你的遠程殘酷分支 message: "hello guys" # 每次提交的信息
需要注意的是,部署到git需要再本地安裝你ssh key,也就是說允許本地進行讀寫遠程git倉庫,否則你會沒權限的
部署到ftp服務器
你可能會用一臺虛擬主機(虛擬主機評測看這裏hostreport.cn)來部署你的hexo個人站點,那麼fip怎麼部署? 首先你需要下載安裝ftp deployer插件:
npm install hexo-deployer-ftpsync --save
,然後把你下面的代碼貼到你的_config.yml中,注意修改ftp的相關參數。#### ftp deploy deploy: type: ftpsync host: ftpserver # ftp服務器地址 user: ftpusername # ftp用戶名 pass: xxxx # 你的ftp用戶密碼 remote: xxx # 你要上傳到的地址,例如/wwwroot port: 21 # ftp端口,不同的ftp可能會不一樣 delete: true # 上傳本地文件是否刪除ftp中的所有文件 verbose: true # 是否打印調試信息 ignore_errors: false # 是否忽略錯誤
同樣要下載hexo deployer:
npm install hexo-deployer-rsync --save
,然後代碼奉上:deploy: type: rsync host: <host> # 主機地址 user: <user> # 用戶名 root: <root> # 要上傳到的目錄 port: [port] # Default is 22 delete: [true|false] # Default is true args: <rsync args> verbose: [true|false] # Default is true ignore_errors: [true|false] # Default is false
原文:
title: hexo自動部署到git、ftp(虛擬主機等)、雲服務器的方式 tag: hexo,git,ftp,雲服務器
自動部署很有用,當你寫完文章後,直接使用hexo d
就可以自動更新你的網站了
部署到git
首先你需要在你的blog下安裝git deployer插件:
npm install hexo-deployer-git --save
,然後再把如下代碼添加到你的_config.yml文件中### git deploy deploy: type: git repo: https://github.com/cmlanche/cmlanche.github.io.git # 你的遠程倉庫 branch: master # 你的遠程殘酷分支 message: "hello guys" # 每次提交的信息
需要注意的是,部署到git需要再本地安裝你ssh key,也就是說允許本地進行讀寫遠程git倉庫,否則你會沒權限的
部署到ftp服務器
你可能會用一臺虛擬主機(虛擬主機評測看這裏hostreport.cn)來部署你的hexo個人站點,那麼fip怎麼部署? 首先你需要下載安裝ftp deployer插件:
npm install hexo-deployer-ftpsync --save
,然後把你下面的代碼貼到你的_config.yml中,注意修改ftp的相關參數。#### ftp deploy deploy: type: ftpsync host: ftpserver # ftp服務器地址 user: ftpusername # ftp用戶名 pass: xxxx # 你的ftp用戶密碼 remote: xxx # 你要上傳到的地址,例如/wwwroot port: 21 # ftp端口,不同的ftp可能會不一樣 delete: true # 上傳本地文件是否刪除ftp中的所有文件 verbose: true # 是否打印調試信息 ignore_errors: false # 是否忽略錯誤
同樣要下載hexo deployer:
npm install hexo-deployer-rsync --save
,然後代碼奉上:deploy: type: rsync host: <host> # 主機地址 user: <user> # 用戶名 root: <root> # 要上傳到的目錄 port: [port] # Default is 22 delete: [true|false] # Default is true args: <rsync args> verbose: [true|false] # Default is true ignore_errors: [true|false] # Default is false
原文:http://www.cmlanche.com/2018/06/20/hexo-deployers/
一個不想命運低頭的黑衣劍士
個人博客:cmlanche.com
我的產品:主機深度評測網
CSDN個人主頁:cmlanche
SegmentFault個人主頁:cmlanche
博客園個人主頁:cmlanche