• Stars
    star
    556
  • Rank 77,371 (Top 2 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 9 years ago
  • Updated about 1 month ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Git deployer plugin for Hexo.

hexo-deployer-git

Build Status NPM version Coverage Status

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.

# You can use this:
deploy:
  type: git
  repo: <repository url>
  branch: [branch]
  token: ''
  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: <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

# Multiple repositories
deploy:
  repo:
    # Either syntax is supported
    [repo_name]: <repository url>[,branch]
    [repo_name]:
      url: <repository url>
      branch: [branch]
  • repo: Repository settings, or plain url of your repo
    • url: Url of your repositury to pull from and push to.
    • branch: Optional git branch to deploy the static site to.
      • Defaults to gh-pages on GitHub.
      • Defaults to coding-pages on Coding.net.
      • Otherwise defaults to master.
    • token: Optional token value to authenticate with the repo. Prefix with $ to read token from environment variable (recommended). Repo must be a http(s) url. More details.
    • repo_name: Unique name when deploying to multiple repositories.
      • Example:
      deploy:
        repo:
          # Either syntax is supported
          github: https://github.com/user/project.git,branch
          gitee:
            url: https://gitee.com/user/project.git
            branch: branch_name
  • branch: Git branch to deploy the static site to. Branch name specified in repo: takes priority.
  • message: Commit message. Defaults to 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: Additional directories to publish. e.g demo, examples
  • ignore_hidden (Boolean|Object): whether ignore hidden files to publish. 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
    # _config.yaml
    deploy:
      - type: git
        repo: [email protected]:<username>/<username>.github.io.git
        branch: master
      - type: git
        repo: [email protected]:<username>/<username>.github.io.git
        branch: src
        extend_dirs: /
        ignore_hidden: false
        ignore_pattern:
            public: .

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

More Repositories

1

hexo

A fast, simple & powerful blog framework, powered by Node.js.
TypeScript
38,563
star
2

site

The website for Hexo. https://hexo.io/
Stylus
653
star
3

awesome-hexo

A curated list of awesome things related to Hexo
614
star
4

hexo-generator-feed

Feed generator for Hexo.
JavaScript
544
star
5

hexo-renderer-markdown-it

Markdown-it is a Markdown parser, done right. A faster and CommonMark compliant alternative for Hexo.
JavaScript
333
star
6

hexo-theme-light

A simple theme for Hexo
Stylus
316
star
7

hexo-math

A hexo plugin that uses MathJax to render math equations.
JavaScript
307
star
8

hexo-theme-landscape

A brand new default theme for Hexo.
Stylus
306
star
9

hexo-generator-sitemap

Sitemap generator for Hexo.
JavaScript
281
star
10

warehouse

JSON database
TypeScript
200
star
11

hexo-renderer-marked

Markdown renderer for Hexo
JavaScript
171
star
12

hexo-starter

Hexo Starter site (use `npx hexo init myBlog`)
170
star
13

hexo-cli

Command line interface for Hexo
TypeScript
170
star
14

hexo-browsersync

BrowserSync plugin for Hexo.
JavaScript
139
star
15

hexo-renderer-pandoc

A pandoc-markdown-flavor renderer for hexo.
JavaScript
110
star
16

hexo-theme-unit-test

This is a dummy Hexo site for theme unit test. You should test your theme before release.
94
star
17

hexo-theme-phase

Feel the flow of time with Phase, the most beautiful theme for Hexo.
Stylus
92
star
18

hexo-util

Utilities for Hexo.
TypeScript
85
star
19

hexo-server

Server module for Hexo.
JavaScript
78
star
20

hexojs.github.io

Replaced by hexojs/site
HTML
59
star
21

hexo-generator-index

Index generator plugin for Hexo.
JavaScript
49
star
22

hexo-generator-alias

Generate alias pages for redirecting to posts, pages or URL
JavaScript
48
star
23

hexo-renderer-ejs

EJS renderer for Hexo
JavaScript
48
star
24

hexo-migrator-wordpress

WordPress migrator for Hexo.
JavaScript
47
star
25

hexo-deployer-rsync

Rsync deployer plugin for Hexo.
JavaScript
45
star
26

hexo-fs

File system module for Hexo.
TypeScript
41
star
27

hexo-generator-archive

Archive generator plugin for Hexo.
JavaScript
36
star
28

hexo-filter-nofollow

Add nofollow attribute to all external links automatically.
JavaScript
36
star
29

hexo-generator-tag

Tag generator plugin for Hexo.
JavaScript
32
star
30

hexo-asset-pipeline

A hexo plugin to minify/optimize HTML, CSS, JS and images. Supports revisioning of assets.
JavaScript
29
star
31

hexo-livereload

Livereload plugin for Hexo
JavaScript
28
star
32

hexo-renderer-jade

Jade renderer for Hexo. Replaced by https://github.com/hexojs/hexo-renderer-pug
JavaScript
28
star
33

hexo-deployer-heroku

Heroku deployer plugin for Hexo.
JavaScript
27
star
34

hexo-generator-category

Category generator plugin for Hexo.
JavaScript
27
star
35

hexo-html-minifier

Minify HTML files with HTMLMinifier.
JavaScript
26
star
36

hexo-filter-auto-spacing

Add spaces between CJK characters and western characters.
JavaScript
24
star
37

hexo-deployer-ftpsync

FTP deployer for Hexo
JavaScript
23
star
38

hexo-pagination

Pagination utilities for Hexo generator plugins.
JavaScript
22
star
39

hexo-front-matter

Front-matter parser
TypeScript
21
star
40

hexo-renderer-stylus

Stylus renderer for Hexo
JavaScript
18
star
41

hexo-filter-responsive-images

Generate mutliple version of images for responsive Hexo blogs
JavaScript
18
star
42

hexo-autoprefixer

Autoprefixer plugin for Hexo.
JavaScript
17
star
43

hexo-filter-lqip

A Hexo plugins which helps to introduce low quality image placeholders to the theme
JavaScript
16
star
44

hexo-clean-css

Minify CSS files with clean-css.
JavaScript
16
star
45

hexo-fontawesome

A utility function which helps to inline fontawesome SVG files.
JavaScript
15
star
46

hexo-renderer-less

Less renderer for Hexo.
JavaScript
14
star
47

hexo-uglify

Minify JavaScript files with UglifyJS.
JavaScript
14
star
48

hexo-i18n

i18n module for Hexo.
TypeScript
13
star
49

hexo-migrator-rss

RSS migrator for Hexo.
JavaScript
12
star
50

hexo-renderer-inferno

Inferno.js JSX renderer for Hexo
JavaScript
11
star
51

hexo-renderer-pug

Pug renderer for Hexo.
JavaScript
10
star
52

hexo-inject

Dynamic script & style (and more) injection for Hexo
JavaScript
10
star
53

hexo-renderer-jsx

JavaScript
9
star
54

hexo-notify

Notification plugin for Hexo.
JavaScript
8
star
55

hexo-webui

Hexo Web UI
Stylus
8
star
56

hexo-renderer-swig

Swig renderer for Hexo
JavaScript
8
star
57

hexo-log

TypeScript
7
star
58

hexo-deployer-openshift

OpenShift deployer plugin for Hexo.
JavaScript
7
star
59

hexo-renderer-haml

Haml renderer for Hexo.
JavaScript
5
star
60

eslint-config-hexo

ESLint config for Hexo projects
JavaScript
5
star
61

hexo-tag-embed

TypeScript
4
star
62

hexo-tag-imgurl

A simple image tag plugin for Hexo.
JavaScript
4
star
63

create-hexo

Hexo site initializer
TypeScript
4
star
64

hexo-renderer-coffeescript

CoffeeScript renderer for Hexo.
JavaScript
4
star
65

hexo-slides

Presentation with Hexo
JavaScript
3
star
66

hexo-renderer-nunjucks

Add support for Nunjucks templates to Hexo websites
JavaScript
3
star
67

hexo-renderer-dot

doT renderer plugin for Hexo
JavaScript
2
star
68

logo

Logo file for Hexo.
2
star
69

hexo-yuidoc

Generate YUIDoc with Hexo
JavaScript
2
star
70

.github

1
star
71

hexo-migrator-blogger

Blogger migrator for Hexo.
JavaScript
1
star