3

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

jottr
  • 3,256
  • 3
  • 29
  • 35
  • Does this answer your question? [git hook post-merge - error: cannot run](https://stackoverflow.com/questions/3563904/git-hook-post-merge-error-cannot-run) – phd Mar 18 '20 at 05:08
  • https://stackoverflow.com/search?q=%5Bgithooks%5D+cannot+run+.git%2Fhooks+No+such+file+or+directory – phd Mar 18 '20 at 05:08

1 Answers1

1

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
jottr
  • 3,256
  • 3
  • 29
  • 35