Deployment

Hexo provides a fast and easy way for deployment. You only need one command to deploy your site to servers.

$ hexo deploy

Before we start, you have to modify settings in _config.yml. A valid deployment setting must come with type field. For example:

deploy:
type: git

You can use multiple deployers. Hexo will execute each deployer in sequence.

deploy:
- type: git
repo:
- type: heroku
repo:

Git

Install hexo-deployer-git.

$ npm install hexo-deployer-git --save

Edit settings.

deploy:
type: git
repo: <repository url>
branch: [branch]

message: [message]
Option Description
repo GitHub repository URL
branch Branch name. The deployer will detect branch automatically if you are using GitHub or GitCafe.
message Customize commit message (Default to Site updated: {{ now('YYYY-MM-DD HH:mm:ss') }})

Heroku

Install hexo-deployer-heroku.

$ npm install hexo-deployer-heroku --save

Edit settings.

deploy:
type: heroku
repo: <repository url>
message: [message]

Option Description
repo, repository Heroku repository URL
message Customize commit message (Default to Site updated: {{ now('YYYY-MM-DD HH:mm:ss') }})

Rsync

Install hexo-deployer-rsync.

$ npm install hexo-deployer-rsync --save

Edit settings.

deploy:
type: rsync
host: <host>
user: <user>
root: <root>
port: [port]

delete: [true|false]
verbose: [true|false]
ignore_errors: [true|false]
Option Description Default
host Address of remote host
user Username
root Root directory of remote host
port Port 22
delete Delete old files on remote host true
verbose Display verbose messages true
ignore_errors Ignore errors false

OpenShift

Install hexo-deployer-openshift.

$ npm install hexo-deployer-openshift --save

Edit settings.

deploy:
type: openshift
repo: <repository url>
message: [message]

Option Description
repo OpenShift repository URL
message Customize commit message (Default to Site updated: {{ now('YYYY-MM-DD HH:mm:ss') }})

FTPSync

Install hexo-deployer-ftpsync.

$ npm install hexo-deployer-ftpsync --save

Edit settings.

deploy:
type: ftpsync
host: <host>
user: <user>
pass: <password>
remote: [remote]

port: [port]
ignore: [ignore]
connections: [connections]
verbose: [true|false]
Option Description Default
host Address of remote host
user Username
pass Password
remote Root directory of remote host /
port Port 21
ignore Ignore the files on either host or remote
connections Connections number 1
verbose Display verbose messages false

Other Methods

All generated files are saved in public folder. You can copy it to wherever you like.