.sh-file execution with PHPStorm (Pre Commit Hook in Windows)

Answered

I want to use the pre-commit-hook plugin in PHPstorm to use phptidy on my code before comiting.

The pre-commit-hook.sh file is located in the project folder and recognized by the plugin.

I set the file association in Windows, so when I double click the file, the script is executed as intended.

However, whenever I try to commit, I get the following error:
Exception while running pre-commit hook : Cannot run program "D:/project/pre-commit-hook.sh" (in directory "D:\project\"): CreateProcess error=193, %1 is not a valid Win32 application
Would you like to commit?

Is there anything I can do to make it work?

As I said, I can execute the file manually and the association is set. It seems that it's PHPstorm that has an issue.When I right-click on the file in PHPstorm, I can run it without issues using the context menu command.

Would appreciate any help.

0
7 comments
Avatar
Permanently deleted user

edit:

It should say '(in directory "D:\project\")'

0
Avatar
Permanently deleted user

Another addition:

When I right-click on the file in PHPstorm, I can run it without issues using the context menu command.

0

Have you tried to use a "pre-commit-hook.bat" file ?

0
Avatar
Permanently deleted user

just did. The pre-commit-hook plugin seems to specifically search for .sh

0
0
Avatar
Permanently deleted user

Thanks for the response Yaroslav. I guess I can't use it then.

0

You may contact plugin vendor and ask them to privide a fix.

0

Please sign in to leave a comment.