致命:无法运行.git / hooks / commit-msg:mac中没有此类文件或目录

时间:2020-03-18 03:00:11

标签: git github version-control githooks

我从未使用过git,最近开始使用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:没有这样的文件或目录

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

1 个答案:

答案 0 :(得分:0)

我遇到了同样的问题。 可能在 commit-msg-hook 中未正确评估所需的 Python 环境的路径。

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

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