fatal: cannot run .git/hooks/commit-msg: No such file or directory in mac

Viewed 1663

I have never used git and have recently started using one. I have created a branch locally.

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

So when I am trying to execute git commit -m "message", it is failing with fatal: cannot run .git/hooks/commit-msg: No such file or directory

What should I do?? I want to commit these changes and publish the branch so that I can raise a pull request for my team. Please Help

1 Answers

I've encountered the same issue. It is possible, that the path to required python environment is not properly evaluated in the commit-msg-hook.

  1. Check your local python version:

Python 3.6.5
  1. Check if your .git/hooks/commit-msg sets the proper shebang, e.g.:
    #!/usr/bin/env python3
Related