自動部署頗有用,當你寫完文章後,直接使用hexo d
就能夠自動更新你的網站了git
首先你須要在你的blog下安裝git deployer插件:npm install hexo-deployer-git --save
,而後再把以下代碼添加到你的_config.yml文件中github
### git deploy deploy: type: git repo: https://github.com/cmlanche/cmlanche.github.io.git # 你的遠程倉庫 branch: master # 你的遠程殘酷分支 message: "hello guys" # 每次提交的信息
須要注意的是,部署到git須要再本地安裝你ssh key,也就是說容許本地進行讀寫遠程git倉庫,不然你會沒權限的shell
你可能會用一臺虛擬主機來部署你的hexo我的站點,那麼fip怎麼部署? 首先你須要下載安裝ftp deployer插件:npm install hexo-deployer-ftpsync --save
,而後把你下面的代碼貼到你的_config.yml中,注意修改ftp的相關參數。npm
#### 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
關於我
一個試圖擺脫「地心引力」的黑衣劍士hexo
一個主機深度評測站主:HostReport.cnssh
一個嚮往自由職業的自由人網站
我的博客:cmlanche.com插件