hexo-deployer-git
Git deployer plugin for Hexo.
Notice: Fatal HttpRequestException Error on pushing to GitHub?
Update Git for Windows to the latest version. (Details)
Installation
$ npm install hexo-deployer-git --save
Options
You can configure this plugin in _config.yml
.
deploy:
type: git
repo: <repository url>
branch: [branch]
token: ''
message: [message]
name: [git user]
email: [git email]
extend_dirs: [extend directory]
ignore_hidden: false
ignore_pattern: regexp
deploy:
type: git
message: [message]
repo: <repository url>[,branch]
extend_dirs:
- [extend directory]
- [another extend directory]
ignore_hidden:
public: false
[extend directory]: true
[another extend directory]: false
ignore_pattern:
[folder]: regexp
deploy:
repo:
[repo_name]: <repository url>[,branch]
[repo_name]:
url: <repository url>
branch: [branch]
Deploy with token
While this plugin can parse authentication token from the config, only use this method if you are sure the config will not be committed, including to a private repo. A more secure approach is to add it to the CI as an environment variable, then simply add the name of the environment variable to this plugin's config (e.g. $GITHUB_TOKEN
).
Additional guides:
- Create a GitHub Personal Access Token. [Link]
- Add authentication token to Travis CI. [Link]
How it works
hexo-deployer-git
works by generating the site in .deploy_git
and force pushing to the repo(es) in config.
If .deploy_git
does not exist, a repo will initialized (git init
).
Otherwise the curent repo (with its commit history) will be used.
Users can clone the deployed repo to .deploy_git
to keep the commit history.
git clone <gh-pages repo> .deploy_git
Reset
Remove .deploy_git
folder.
$ rm -rf .deploy_git
License
MIT