markdown [hexo-deployer-git](https://github.com/hexojs/hexo-deployer-git)使用说明文件
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown [hexo-deployer-git](https://github.com/hexojs/hexo-deployer-git)使用说明文件相关的知识,希望对你有一定的参考价值。
# hexo-deployer-git
[![Build Status](https://travis-ci.org/hexojs/hexo-deployer-git.svg?branch=master)](https://travis-ci.org/hexojs/hexo-deployer-git) [![NPM version](https://badge.fury.io/js/hexo-deployer-git.svg)](http://badge.fury.io/js/hexo-deployer-git) [![Coverage Status](https://img.shields.io/coveralls/hexojs/hexo-deployer-git.svg)](https://coveralls.io/r/hexojs/hexo-deployer-git?branch=master) [![Build status](https://ci.appveyor.com/api/projects/status/liqy4nib33ht70so/branch/master?svg=true)](https://ci.appveyor.com/project/tommy351/hexo-deployer-git/branch/master)
Git deployer plugin for [Hexo].
## Notice: Fatal HttpRequestException Error on pushing to GitHub?
Update [Git for Windows](https://github.com/git-for-windows/git/releases) to the latest version. ([Details](https://github.com/Microsoft/Git-Credential-Manager-for-Windows#notice-experiencing-github-pushfetch-problems))
## Installation
``` bash
$ npm install hexo-deployer-git --save
```
If you want to use the latest features of hexo-deployer-git, you may install it from github:
* for npm version under 4
``` bash
$ npm install git+git@github.com:hexojs/hexo-deployer-git.git --save
```
* for npm version 5
```bash
$ npm install git+ssh://git@github.com:hexojs/hexo-deployer-git.git --save
```
## Options
You can configure this plugin in `_config.yml`.
``` yaml
# You can use this:
deploy:
type: git
repo: <repository url>
branch: [branch]
message: [message]
name: [git user]
email: [git email]
extend_dirs: [extend directory]
ignore_hidden: false # default is true
ignore_pattern: regexp # whatever file that matches the regexp will be ignored when deploying
# or this:
deploy:
type: git
message: [message]
repo:
github: <repository url>,[branch]
coding: <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 # or you could specify the ignore_pattern under a certain directory
```
- **repo**: Repository URL
- **branch**: Git branch to deploy the static site to
- **message**: Commit message. The default commit message is `Site updated: {{ now('YYYY-MM-DD HH:mm:ss') }}`.
- **name** and **email**: User info for committing the change, overrides global config. This info is independent of git login.
- **extend_dirs**: Add some extensions directory to publish. e.g `demo`, `examples`
- **ignore_hidden** (Boolean|Object): whether ignore hidden files to publish. the github requires the `.nojekyll` in root.
* Boolean: for all dirs.
* Object: for public dir and extend dir:
* `public`: the public dir defaults.
* [extend directory]
- **ignore_pattern** (Object|RegExp): Choose the ignore pattern when deploying
* RegExp: for all dirs.
* Object: specify the ignore pattern under certain directory. For example, if you want to push the source files and generated files at the same time to two different branches. The option should be like
```yaml
# _config.yaml
deploy:
- type: git
repo: git@github.com:<username>/<username>.github.io.git
branch: master
- type: git
repo: git@github.com:<username>/<username>.github.io.git
branch: src
extend_dirs: /
ignore_hidden: false
ignore_pattern:
public: .
```
## 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.
``` bash
$ rm -rf .deploy_git
```
## License
MIT
[Hexo]: http://hexo.io/
以上是关于markdown [hexo-deployer-git](https://github.com/hexojs/hexo-deployer-git)使用说明文件的主要内容,如果未能解决你的问题,请参考以下文章