Code Monkey home page Code Monkey logo

hexo-deployer-git's Introduction

hexo-deployer-git

CI 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. If you've configured SSH key authentication for git, ensure you use the SSH protocol format (for example, [email protected]:) for your repository URL to avoid password prompts or access denial due to security policies.
    • 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]

Important Notice: Force Push Behavior

The hexo-deployer-git plugin employs a force push (git push --force) strategy when deploying updates to your site. This approach ensures that the remote repository aligns exactly with your local deployment, providing a clean, consistent state for each update. However, it comes with an important consideration regarding custom modifications.

Impact of Force Push

Using force push means that any changes made directly in the remote repository (e.g., via GitHub's web interface or through a separate git workflow) will be overwritten when the next deployment occurs. This is because force push does not merge changes; it replaces the remote content with the local version entirely.

How to Safely Manage Your Site

To prevent unintended loss of work, we strongly advise adhering to the following best practices:

  1. Centralize Changes in Your Hexo Source: Make all content and configuration changes within your local Hexo root directory. This ensures all modifications are included in the deployment process and preserved in your source control.

  2. Avoid Direct Remote Modifications: Refrain from directly editing files in the GitHub repository through the web interface or other git methods. Doing so could lead to these changes being lost on the next deployment.

Custom Domain Issue with CNAME File

If you are using a custom domain with GitHub Pages, you might have encountered an issue where your custom domain configuration gets lost after deploying updates to your site. This problem occurs due to the overwritten / deletion of the CNAME file in the root of the deployed directory during the git commit and push process performed by the hexo-deployer-git plugin.

GitHub requires the CNAME file to be present in your repository to associate your custom domain with your GitHub Pages site. When this file is missing, GitHub resets the custom domain setting, leading to the site being accessible only through the default github.io domain.

Solution

To ensure your custom domain remains active with each deployment, you need to include the CNAME file in your blog's source/ directory. Here's how you can do it:

  1. Create a CNAME File: In the root of your blog's source/ directory, create a file named CNAME. Inside this file, enter your custom domain name. For example, if your custom domain is example.com, the content of the CNAME file should be:
    example.com
    
  2. Deploy Your Site: Use the hexo-deployer-git plugin to deploy your site as usual. Run hexo g -d command, the plugin will now include the CNAME file in the deployment, and your custom domain configuration will remain intact.

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

hexo-deployer-git's People

Contributors

chrisyer avatar curbengh avatar cy20lin avatar d-sketon avatar dependabot-preview[bot] avatar dependabot-support avatar dependabot[bot] avatar h404bi avatar jlhwung avatar kagawagao avatar laoshu133 avatar leesei avatar loatheb avatar marocchino avatar noahdragon avatar segayuu avatar snowyu avatar stevenjoezhang avatar sukkaw avatar tomap avatar tommy351 avatar uiolee avatar xiaozhikang0916 avatar xuanwo avatar yoshinorin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hexo-deployer-git's Issues

Cannot deploy when src refspec is not master

In a .deploy_git repo, if the src refspec is NOT master, deploy would fail.
e.g. The src refspec is pages in https://travis-ci.org/h404bi/notes/builds/63832305
498 error: src refspec master does not match any.

The problem is that because in lib deployer.js, src refspec is specified to master:
https://github.com/hexojs/hexo-deployer-git/blob/master/lib/deployer.js#L71

 return git('push', '-u', repo.url, 'master:' + repo.branch, '--force');

Remove 'master:' + should solve the problem, maybe has other solutions.

 return git('push', '-u', repo.url, repo.branch, '--force');

使用hexo -d 没有反应是怎么回事?

使用hexo -d 没有反应是怎么回事?

zjydeMacBook-Pro:Blog zjy$ hexo d
zjydeMacBook-Pro:Blog zjy$ ls -a
. .npmignore node_modules scaffolds
.. _config.yml package.json source
.gitignore db.json public themes
zjydeMacBook-Pro:Blog zjy$

.deploy_git 这个目录也没有生成?

优先使用本地git信息匹配

在执行hexo deploy时得到如下说明。

由于我有很多不同的git账号,所以一般情况下,我是不会匹配全局账号的。
但是hexo deploy时则会要求全局账号,这种情况可能会影响到不同源码库的提交。
所以建议使用当前库里的github账号。

即在hexo deploy执行的当前目录里寻找 .git/config里面的账号信息进行deploy.
而我的.git/config已经匹配了user的信息

*** Please tell me who you are.

Run

  git config --global user.email "[email protected]"
  git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

After deploy, github page (with custom domain) goes down for a couple of minutes.

Hey there, loving Hexo so far, thanks for all of the hard work put into it.
I've got my github pages set up perfectly with my domain (patrickbollenbach.me) . All is well for the most part.

Except when I deploy to my "patrickbolle.github.io" repo using the hexo deploy command --
My pages domain goes down for a couple minutes.
I've got a CNAME file directing to patrickbollenbach.me so patrickbolle.github.io will always redirect to that domain.

Anybody have this problem?
it's not a major deal, but if i'm making small mods/new posts/ etc my site will keep crashing even for small periods of time.

Thanks!

Hidden file is not deployed into git.

If you have hidden file (with trailing .), the file will not be deployed into git. This blocks adding .nojekyll file for github files.

fs.copyDir(publicDir, deployDir) ignores hidden file by default.

Does not deploy .htaccess file

I have created a generator that generates an .htaccess file in the public directory as expected when I execute the hexo generate command.

Unfortunately, I cannot seem to get the git deployer to generate this file in the .deploy_git directory. I have tried setting ignore_hidden: false which did not work, nor did specifically setting the public directory to ignore_hidden to false.

This pattern has worked for me in the past, although with files that do not start with a .

My generator is as follows:

var fs = require('hexo-fs');
var path = require('path');

hexo.extend.generator.register('htaccess', function(locals) {
    return {
        path: '.htaccess',
        data: function() {
            return fs.createReadStream(path.join(__dirname, '..','.htaccess'));
        }
    }
});

multi-git-deployer go wrong

deploy:
  type: git
  message: [message]
  repo: 
    github: <repository url>,[branch]
    gitcafe: <repository url>,[branch]

我采用如上的方式去配置_config.yml文件,目的就是想要同时推送到多个remote,悲剧的是,在推送时报错了。

报错信息跟这个很类似,不过我是在本地操作也是报错。

环境如下,

{ 'hexo-site': '0.0.0',
  npm: '3.4.1',
  ares: '1.10.1-DEV',
  http_parser: '2.5.0',
  icu: '56.1',
  modules: '47',
  node: '5.0.0',
  openssl: '1.0.2d',
  uv: '1.7.5',
  v8: '4.6.85.28',
  zlib: '1.2.8' }

发布到github上报错

我的配置:
# Deployment
## Docs: http://hexo.io/docs/deployment.html
deploy:
type: git
repo: https://github.com/MarcoPai/MarcoPai.github.io.git
branch: master

输入 hexo d 之后的报错:

INFO Copying files from public folder...
events.js:85
throw er; // Unhandled 'error' event
^
Error: spawn git ENOENT
at exports._errnoException (util.js:746:11)
at Process.ChildProcess._handle.onexit (child_process.js:1053:32)
at child_process.js:1144:20
at process._tickCallback (node.js:355:11)

deploy 到 github 时报错

操作系统 mac ox 10.10.4
nodejs 版本 v0.12.7
hexo-deployer-git 版本 0.0.4

提示信息:

➜ blog hexo deploy
[info] Start deploying: git
[error] TypeError: Arguments to path.join must be strings
TypeError: Arguments to path.join must be strings
at Object.posix.join (path.js:488:13)
at Object.module.exports as git
at /usr/local/lib/node_modules/hexo/lib/plugins/console/deploy.js:76:22
at iterate (/usr/local/lib/node_modules/hexo/node_modules/async/lib/async.js:149:13)
at Object.async.eachSeries (/usr/local/lib/node_modules/hexo/node_modules/async/lib/async.js:165:9)
at /usr/local/lib/node_modules/hexo/lib/plugins/console/deploy.js:66:11
at /usr/local/lib/node_modules/hexo/lib/plugins/console/deploy.js:32:27
at FSReqWrap.cb as oncomplete

Getting more done in GitHub with ZenHub

Hola! @malikperang has created a ZenHub account for the hexojs organization. ZenHub is the only project management tool integrated natively in GitHub – created specifically for fast-moving, software-driven teams.


How do I use ZenHub?

To get set up with ZenHub, all you have to do is download the browser extension and log in with your GitHub account. Once you do, you’ll get access to ZenHub’s complete feature-set immediately.

What can ZenHub do?

ZenHub adds a series of enhancements directly inside the GitHub UI:

  • Real-time, customizable task boards for GitHub issues;
  • Multi-Repository burndown charts, estimates, and velocity tracking based on GitHub Milestones;
  • Personal to-do lists and task prioritization;
  • Time-saving shortcuts – like a quick repo switcher, a “Move issue” button, and much more.

Add ZenHub to GitHub

Still curious? See more ZenHub features or read user reviews. This issue was written by your friendly ZenHub bot, posted by request from @malikperang.

ZenHub Board

when i was trying to deploy on git, i got this issue

INFO  Deploying: git
FATAL Something's wrong. Maybe you can find the solution here: http://hexo.io/docs/troubleshooting.html
TypeError: undefined is not a function
    at Object.exports.parse (/Users/JoshPAT/Documents/my_blog/node_modules/hexo-deployer-git/node_modules/swig/lib/parser.js:438:19)
    at parse (/Users/JoshPAT/Documents/my_blog/node_modules/hexo-deployer-git/node_modules/swig/lib/swig.js:354:19)
    at Object.precompile (/Users/JoshPAT/Documents/my_blog/node_modules/hexo-deployer-git/node_modules/swig/lib/swig.js:486:23)
    at Object.compile (/Users/JoshPAT/Documents/my_blog/node_modules/hexo-deployer-git/node_modules/swig/lib/swig.js:606:16)
    at commitMessage (/Users/JoshPAT/Documents/my_blog/node_modules/hexo-deployer-git/lib/deployer.js:95:15)
    at Hexo.module.exports (/Users/JoshPAT/Documents/my_blog/node_modules/hexo-deployer-git/lib/deployer.js:21:17)
    at Hexo.tryCatcher (/Users/JoshPAT/Documents/my_blog/node_modules/hexo/node_modules/bluebird/js/main/util.js:24:31)
    at Hexo.<anonymous> (/Users/JoshPAT/Documents/my_blog/node_modules/hexo/node_modules/bluebird/js/main/method.js:15:34)
    at /Users/JoshPAT/Documents/my_blog/node_modules/hexo/lib/plugins/console/deploy.js:56:28
    at tryCatcher (/Users/JoshPAT/Documents/my_blog/node_modules/hexo/node_modules/bluebird/js/main/util.js:24:31)
    at ReductionPromiseArray._promiseFulfilled (/Users/JoshPAT/Documents/my_blog/node_modules/hexo/node_modules/bluebird/js/main/reduce.js:103:38)
    at ReductionPromiseArray.init [as _init$] (/Users/JoshPAT/Documents/my_blog/node_modules/hexo/node_modules/bluebird/js/main/promise_array.js:92:18)
    at Promise._settlePromiseAt (/Users/JoshPAT/Documents/my_blog/node_modules/hexo/node_modules/bluebird/js/main/promise.js:528:21)
    at Promise._settlePromises (/Users/JoshPAT/Documents/my_blog/node_modules/hexo/node_modules/bluebird/js/main/promise.js:646:14)
    at Async._drainQueue (/Users/JoshPAT/Documents/my_blog/node_modules/hexo/node_modules/bluebird/js/main/async.js:177:16)
    at Async._drainQueues (/Users/JoshPAT/Documents/my_blog/node_modules/hexo/node_modules/bluebird/js/main/async.js:187:10)
    at Immediate.Async.drainQueues [as _onImmediate] (/Users/JoshPAT/Documents/my_blog/node_modules/hexo/node_modules/bluebird/js/main/async.js:15:14)
    at processImmediate [as _immediateCallback] (timers.js:358:17)

btw, I am using Mac OS 10.9.5...

hexo deploy 时指定git账户

前提: ~/.gitconfig文件中设置的全局参数

[user]
	name = global_name
	email = global_email

然后在_config.yml中设置

deploy:
- type: git
  repo: github_repo
  branch: [branch]
  name: github_name
  email: github_email
- type: git
  repo: coding_repo
  branch: [branch]
  name: coding_name
  email: coding_email

执行hexo deploy提交后,查看github和coding,commit的作者是 global_name global_email

Can it pull existing repo into deployDir instead of initializing new ?

According to this code https://github.com/hexojs/hexo-deployer-git/blob/master/lib%2Fdeployer.js#L54
plugin try to fins exisiting deployDir and if not - create and Init new repo, then creates a "First commit".

When I make deployments from my dev machine - it is fine (repo is created once and then commits are added), but when I use "CircleCI" CI/CD service - it makes each build in clean Docker container, so deloyDir is always absent. That's why "gh-pages" branch always cleared and rewritten with 2 commits - "First commit" and "Repo is updated...".

I thought that is could be a way - to try to checkout exisiting repo/branch first and only if there is nothing - try to init new. What do you think ?

P.S. That's not a critical thing, but would look nicer and not confusing.

No error message when there is parsing error in _config.yml

  • Problem
    Running hexo d have no output. No error message or warnings, and nothing happened, files are not deployed too.
  • Cause
    There is syntax error in _config.yml. When running hexo clean, there is error messages indicate the error. Once it is corrected, hexo d can run normally. There could be other problems with git setup but at least there is error messages.
  • Suggestion
    There should be meaningful error messages in this case, either from deployer plugin or yml parser, but there should be messages instead of no output, which looks like success.

部署失败

提示 ERROR Deployer not found: git
配置里是有相应配置段的

deploy:
  type: git
  repo: https://github.com/ycf-FED/ycf-FED.github.io.git
  branch: master

<username.github.io> deploy issues

This plugin seems seems to use an 'anti-pattern' to deploy sites to Github as a very different repository than what I have in my working directory. I don't know if I have it misconfigured or what, but I end up with a completely different repository layout on Github when using hexo-deployer-git than what I started with on my machine -- and I don't like that. It's a pretty bad misuse of git, I think.

I had everything setup and working using hexo server, but when I deployed it, my CNAME file and atom.xml file were missing. I'm using runlevelsix.github.io as my repo name - which does not use a gh-pages branch - only the master branch.

In the _config.yml file, I expected I could set the config.public_dir to something like the current directory, but that failed to have the expected results - pretty much all of my source files were deleted (major problem)...

Is this a git deployer issue, a haxo issue, or a github pages issue?

We need .nojekyll file

Hi.
Some directories don't appear on the web because of Jekyll.
I found out a solution from the internet: .nojekyll file has to be added to the root directory after deployment. Currently, I add that file manually every time after deployment.
Could you add it to the deploying process?
thanks.

How to commit over SSH

Hi,

In my local copy of my hexo site's GitHub repo I have changed my remote origin and upstream to the corresponding SSH versions (i.e., to [email protected]:fusion809/hexo-site.git), my SSH key has been added to my GitHub account and my SSH agent has been started (which I know for certain as whenever I try to commit to other repos that I have set to commit via SSH, everything goes without a hitch, without me having to provide my username and password), yet whenever I run hexo deploy --generate I am forced to enter my GitHub username and password, like as if this plugin is ignoring my new remote. Is there something I've missed that I need to do in order to authenticate my deployments via SSH?

Here is the output of git remote -v being run in my local copy of my hexo-site GitHub repo, in case you suspect I've messed up changing my remote:

origin  [email protected]:fusion809/hexo-site.git (fetch)
origin  [email protected]:fusion809/hexo-site.git (push)
upstream        [email protected]:fusion809/hexo-site.git (fetch)
upstream        [email protected]:fusion809/hexo-site.git (push)

Thanks for your time,
Brenton

Deploy to master branch

My repo save origin source Hexo project file at Master branch, and generated file at gh-pages branch.

When I update to the separated hexo-deployer-git, and run hexo d at my working directory at Master branch, it always push .deploy_git to origin master, not origin gh-pages.

Permission denied when I used ssh

As title, I setup my repo with ssh put it failed when I try to deploy at Github ....

Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
FATAL Something's wrong. Maybe you can find the solution here: http://hexo.io/docs/troubleshooting.html
Error: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

    at ChildProcess.<anonymous> (C:\cygwin64\home\user\Github\_hexo\hexo-tag-owl-demo\node_modules\hexo-util\lib\spawn.js:42:17)
    at emitTwo (events.js:87:13)
    at ChildProcess.emit (events.js:172:7)
    at maybeClose (internal/child_process.js:818:16)
    at Socket.<anonymous> (internal/child_process.js:319:11)
    at emitOne (events.js:77:13)
    at Socket.emit (events.js:169:7)
    at Pipe._onclose (net.js:469:12)

And my config

hexo: 3.1.1
os: Windows_NT 10.0.10240 win32 x64
http_parser: 2.5.0
node: 4.2.1
v8: 4.5.103.35
uv: 1.7.5
zlib: 1.2.8
ares: 1.10.1-DEV
icu: 56.1
modules: 46
openssl: 1.0.2d

if branch has ':' will go wrong

my blog has a branch named 'master:1', when I wrote it follow in config.yaml:

deploy:
type: git
repo: https://git.sinacloud.com/netcanblog
branch: master:1

and I hexo -d will go wrong:

error: src refspec HEAD:master does not match any.
error: failed to push some refs to 'https://git.sinacloud.com/netcanblog'

I think it should be a conflict because it has ':'

a syntax error

README.md

Users can to clone the deployed repo to .deploy_git to keep the commit history.

Users can clone ...

deploy指令需要更新了

如下

warning: 在 Git 2.0 版本,位于一个子目录下不带任何路径参数地执行命令
'git add --all (或 -A)' 的行为将被改变,不要再继续使用了。
如果要添加整个目录树的内容,执行:

  git add --all :/
  (或 git add -A :/)

如果要限制该命令只作用于当前目录,执行:

  git add --all .
  (或 git add -A .)

对于当前版本的 Git,这条命令只作用于当前目录。

deploy指令需要更新了

From @RanchoCooper on June 8, 2016 18:42

如下

warning: 在 Git 2.0 版本,位于一个子目录下不带任何路径参数地执行命令
'git add --all (或 -A)' 的行为将被改变,不要再继续使用了。
如果要添加整个目录树的内容,执行:

  git add --all :/
  (或 git add -A :/)

如果要限制该命令只作用于当前目录,执行:

  git add --all .
  (或 git add -A .)

对于当前版本的 Git,这条命令只作用于当前目录。

Copied from original issue: hexojs/hexo#1997

Resources are not deployed

Hello,

I executed hexo generate --deploy today to deploy my page to: https://bennyn.github.io/internet-of-chili/

The command deployed the page (which is pretty cool) but all resources (like bootstrap/css/bootstrap.min.css) are missing. Maybe you can help me to find out why.

My deployment configuration is this:

_config.yml

deploy:
  type: git
  repo: [email protected]:bennyn/internet-of-chili.git
  branch: gh-pages

And I am using the clean-blog theme.

My project is located here:

Did I forgot to configure something? Because I can see that the expected bootstrap directory is missing in my gh-pages branch. 😢

ERROR Deployer not found: git

[email protected] /Users/jhp-android/Desktop/github/edagarli.github.io
├─┬ [email protected]
│ └─┬ [email protected]
│ ├── [email protected]
│ └── [email protected]
└─┬ [email protected]
├─┬ [email protected]
│ ├── [email protected]
│ ├─┬ [email protected]
│ │ └── [email protected]
│ ├── [email protected]
│ └── [email protected]
└─┬ [email protected]
├── [email protected]
└── [email protected]

justhacker:edagarli.github.io justhacker$ hexo deploy
ERROR Deployer not found: git

deploy之后仓库里的历史文件都被删除

执行deploy命令之后,原有未更新的旧版本文件都被删除了(比如readme.md文件)
每次更新,我并没有更新readme,但是我github仓库里的readme被删除了
可以保留旧版本文件么?

when i was trying to deploy on git, i got this issue

From @JoshPAT on May 18, 2015 22:15

INFO  Deploying: git
FATAL Something's wrong. Maybe you can find the solution here: http://hexo.io/docs/troubleshooting.html
TypeError: undefined is not a function
    at Object.exports.parse (/Users/JoshPAT/Documents/my_blog/node_modules/hexo-deployer-git/node_modules/swig/lib/parser.js:438:19)
    at parse (/Users/JoshPAT/Documents/my_blog/node_modules/hexo-deployer-git/node_modules/swig/lib/swig.js:354:19)
    at Object.precompile (/Users/JoshPAT/Documents/my_blog/node_modules/hexo-deployer-git/node_modules/swig/lib/swig.js:486:23)
    at Object.compile (/Users/JoshPAT/Documents/my_blog/node_modules/hexo-deployer-git/node_modules/swig/lib/swig.js:606:16)
    at commitMessage (/Users/JoshPAT/Documents/my_blog/node_modules/hexo-deployer-git/lib/deployer.js:95:15)
    at Hexo.module.exports (/Users/JoshPAT/Documents/my_blog/node_modules/hexo-deployer-git/lib/deployer.js:21:17)
    at Hexo.tryCatcher (/Users/JoshPAT/Documents/my_blog/node_modules/hexo/node_modules/bluebird/js/main/util.js:24:31)
    at Hexo.<anonymous> (/Users/JoshPAT/Documents/my_blog/node_modules/hexo/node_modules/bluebird/js/main/method.js:15:34)
    at /Users/JoshPAT/Documents/my_blog/node_modules/hexo/lib/plugins/console/deploy.js:56:28
    at tryCatcher (/Users/JoshPAT/Documents/my_blog/node_modules/hexo/node_modules/bluebird/js/main/util.js:24:31)
    at ReductionPromiseArray._promiseFulfilled (/Users/JoshPAT/Documents/my_blog/node_modules/hexo/node_modules/bluebird/js/main/reduce.js:103:38)
    at ReductionPromiseArray.init [as _init$] (/Users/JoshPAT/Documents/my_blog/node_modules/hexo/node_modules/bluebird/js/main/promise_array.js:92:18)
    at Promise._settlePromiseAt (/Users/JoshPAT/Documents/my_blog/node_modules/hexo/node_modules/bluebird/js/main/promise.js:528:21)
    at Promise._settlePromises (/Users/JoshPAT/Documents/my_blog/node_modules/hexo/node_modules/bluebird/js/main/promise.js:646:14)
    at Async._drainQueue (/Users/JoshPAT/Documents/my_blog/node_modules/hexo/node_modules/bluebird/js/main/async.js:177:16)
    at Async._drainQueues (/Users/JoshPAT/Documents/my_blog/node_modules/hexo/node_modules/bluebird/js/main/async.js:187:10)
    at Immediate.Async.drainQueues [as _onImmediate] (/Users/JoshPAT/Documents/my_blog/node_modules/hexo/node_modules/bluebird/js/main/async.js:15:14)
    at processImmediate [as _immediateCallback] (timers.js:358:17)

btw, I am using Mac OS 10.9.5...

Copied from original issue: hexojs/hexo#1280

Config not works

Hello, I use hexo-deployer-git to send blogs to my VPS. Although my SSH config set port, hexo still use port 22 to connect my vps. Here is my config file:

Host 104.224.164.243
HostName 104.224.164.243
Port 28806
User git
IdentityFile ~/.ssh/id_rsa

When I use "ssh -t [email protected]" via Terminal, the config file worked. I use macOS Sierra.
Any way to fix this problem? Waiting for your relpy.
Thank you .

multi git still heve problem~

log from travis-CI is as follow.

The command "hexo g" exited with 0.
$ hexo d
INFO  Deploying: git
INFO  Setting up Git deployment...
Initialized empty Git repository in /home/travis/build/Xuanwo/xuanwo.github.io/.deploy_git/.git/
[master (root-commit) e047986] First commit
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 placeholder
INFO  Clearing .deploy folder...
INFO  Copying files from public folder...
fatal: Unable to create '/home/travis/build/Xuanwo/xuanwo.github.io/.deploy_git/.git/index.lock': File exists.

If no other git process is currently running, this probably means a
git process crashed in this repository earlier. Make sure no other git
process is running and remove the file manually to continue.
FATAL Something's wrong. Maybe you can find the solution here: http://hexo.io/docs/troubleshooting.html
Error: fatal: Unable to create '/home/travis/build/Xuanwo/xuanwo.github.io/.deploy_git/.git/index.lock': File exists.

If no other git process is currently running, this probably means a
git process crashed in this repository earlier. Make sure no other git
process is running and remove the file manually to continue.

    at ChildProcess.<anonymous> (/home/travis/build/Xuanwo/xuanwo.github.io/node_modules/hexo-deployer-git/node_modules/hexo-util/lib/spawn.js:42:17)
    at ChildProcess.emit (events.js:98:17)
    at maybeClose (child_process.js:766:16)
    at Socket.<anonymous> (child_process.js:979:11)
    at Socket.emit (events.js:95:17)
    at Pipe.close (net.js:466:12)

The command "hexo d" exited with 1.

Done. Your build exited with 1.

I think we don't need to create a new dir, just add a new remote in git.

add this for every git address:

script:
- git push [email protected]:Xuanwo/xuanwo.github.io.git master:master --force
- git push [email protected]:xuanwo/xuanwo.git master:gitcafe-pages --force

addons:
  ssh_known_hosts:
  - github.com
  - gitcafe.com

Well, I'm try to fix it by myself. But according to I have no experience in js, it may take some time, sorry for all.

Add option to create commit and not push

I think pushing for deployment is a bit much, or at least it is in my case. I think it would be awesome to add an option where the user could configure it to say "deploy and commit to the branch locally, but don't push"

if push failed, it will still shows "deploy done", and when run "hexo d" again, it will shows "nothing to commit"

And i delete .deploy_git folder, it will block like this:

 create mode 100644 js/pace.js
 create mode 100644 js/pc.js
 create mode 100644 js/pc.js.bak
 create mode 100644 js/plugins.js
 create mode 100644 js/raphael.js
 create mode 100644 js/sequence-diagram.js
 create mode 100644 js/underscore.js
 delete mode 100644 placeholder
 create mode 100644 tags/flowchart-js/index.html
 create mode 100644 tags/gdb/index.html
 create mode 100644 tags/js-sequece-diagrams/index.html
 create mode 100644 tags/toc/index.html

just block here, and I don't know what's wrong

avoid force push when deploy to git repository

Here is the disadvantage of force push

  • Losing history. (less important as we don't care in this deploy branch)
  • Increasing pushing time which always pushing all assets.

So suggest avoid force push when deploy to git repository.

when i was trying to deploy on git, i got this issue

INFO Deploying: git
FATAL Something's wrong. Maybe you can find the solution here: http://hexo.io/docs/troublesho...
TypeError: undefined is not a function
at Object.exports.parse (/opt/hexo/node_modules/hexo-deployer-git/node_modules/swig/lib/parser.js:438:19)
at parse (/opt/hexo/node_modules/hexo-deployer-git/node_modules/swig/lib/swig.js:354:19)
at Object.precompile (/opt/hexo/node_modules/hexo-deployer-git/node_modules/swig/lib/swig.js:486:23)
at Object.compile (/opt/hexo/node_modules/hexo-deployer-git/node_modules/swig/lib/swig.js:606:16)
at commitMessage (/opt/hexo/node_modules/hexo-deployer-git/lib/deployer.js:95:15)
at Hexo.module.exports (/opt/hexo/node_modules/hexo-deployer-git/lib/deployer.js:21:17)
at Hexo.tryCatcher (/opt/hexo/node_modules/hexo/node_modules/bluebird/js/main/util.js:24:31)
at Hexo. (/opt/hexo/node_modules/hexo/node_modules/bluebird/js/main/method.js:15:34)
at /opt/hexo/node_modules/hexo/lib/plugins/console/deploy.js:56:28
at tryCatcher (/opt/hexo/node_modules/hexo/node_modules/bluebird/js/main/util.js:24:31)
at ReductionPromiseArray._promiseFulfilled (/opt/hexo/node_modules/hexo/node_modules/bluebird/js/main/reduce.js:103:38)
at ReductionPromiseArray.init as _init$
at Promise._settlePromiseAt (/opt/hexo/node_modules/hexo/node_modules/bluebird/js/main/promise.js:528:21)
at Promise._settlePromises (/opt/hexo/node_modules/hexo/node_modules/bluebird/js/main/promise.js:646:14)
at Async._drainQueue (/opt/hexo/node_modules/hexo/node_modules/bluebird/js/main/async.js:177:16)
at Async._drainQueues (/opt/hexo/node_modules/hexo/node_modules/bluebird/js/main/async.js:187:10)
at Immediate.Async.drainQueues as _onImmediate
at processImmediate as _immediateCallback

two deployer

I should how to write when having two deplyer,

deploy:
  type: git
  repo: xxx
  branch: master
  message: Site updated:{{ now('YYYY-MM-DD HH:mm:ss') }}
deploy:
  type: othertype

when I write like this, I get a error, “duplicated mapping key ” .
I don't know how to do ,I will modify some one deployer or not ?
and I know this not git deployer wrong. but if we can do this better, why not ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.