【问题标题】:fatal: cannot run .git/hooks/commit-msg: No such file or directory in mac致命:无法运行 .git/hooks/commit-msg:mac 中没有这样的文件或目录
【发布时间】:2020-03-18 03:00:11
【问题描述】:

我从未使用过 git,最近才开始使用。 我已经在本地创建了一个分支。

FWS-CHE-LT-3532:amit$ git branch
* abc_123
  staging
FWS-CHE-LT-3532:amit$ git status
On branch abc_123
Your branch is up to date with 'origin/abc_123'.

Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

new file:   api/app/controllers/constants/mproject_constants.rb
new file:   api/app/controllers/mproject_controller.rb
new file:   api/app/controllers/validationsmproject_validation.rb
new file:   app/blueprints/helpdesk/mproject_blueprint.rb
modified:   config/privileges.rb
modified:   config/routes/api/routes.rb

因此,当我尝试执行 git commit -m "message" 时,它以致命的方式失败:无法运行 .git/hooks/commit-msg: No such file or directory

我该怎么办?? 我想提交这些更改并发布分支,以便我可以为我的团队提出拉​​取请求。请帮忙

【问题讨论】:

标签: git github version-control githooks


【解决方案1】:

我也遇到过同样的问题。 在commit-msg-hook 中可能没有正确评估所需python 环境的路径。

  1. 检查您的本地 python 版本:

Python 3.6.5
  1. 检查您的 .git/hooks/commit-msg 是否设置了正确的 shebang,例如:
    #!/usr/bin/env python3

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-03-12
    • 2021-04-29
    • 2018-04-13
    • 1970-01-01
    • 1970-01-01
    • 2023-02-08
    • 1970-01-01
    相关资源
    最近更新 更多