2

我在我的pre-push钩子中使用代码 0 退出,但推送从未发生。知道为什么我的钩子成功结束但推送没有发生吗?

这是我的husky.config.js

module.exports = {
  hooks: {
    'post-checkout': 'post-checkout',
    'pre-commit': 'lint-staged',
    'commit-msg': 'commit-msg && commitlint -E HUSKY_GIT_PARAMS',
    'pre-push':
      'yarn && yarn lint && yarn build && yarn test && echo $? && exit 0'
  }
};

疑难解答✅</p>

吉特:git version 2.24.2 (Apple Git-127)

操作系统:macOS Catalina 10.15.3

终端:VSCode 1.44.2

命令:

HUSKY_DEBUG=1 yarn add husky --save-dev -W

输出:

[4/4]   Building fresh packages...
success Saved 1 new dependency.
info Direct dependencies
└─ husky@4.2.5
info All dependencies
└─ husky@4.2.5
$ patch-package
patch-package 6.2.0
Applying patches...
No patch files found
✨  Done in 27.15s.

命令:

HUSKY_DEBUG=1 git push

输出:

...
Test Suites: 8 passed, 8 total
Tests:       113 passed, 113 total
Snapshots:   7 passed, 7 total
Time:        16.087s
Ran all test suites in 8 projects.
0
husky:debug yarn run --silent husky-run exited with 0 exit code
4

0 回答 0