Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Github desktop and git hooks

I am having an issue with implementing git hooks with the Github Desktop client for windows. When I created the hook, it runs a python script that checks the commit message. The weird part is, it runs on perfectly fine on Windows with command prompt, powershell, tortoisegit, webstorm IDE, git bash, also works on Linux terminal, EXCEPT for Github Windows client. reading the debug log, i get this error

GitHub.IO.ProcessException: /usr/bin/env: python: No such file or directory

My already attempted solutions:

  • adding 'python' as system variable
  • using ruby
  • removing '/usr/bin/env' (this will throw an error saying this file doesn't exists)
  • adding a .bashrc file solution i found online by putting the python path in my home directory

Does anyone have any idea how to fix this?

like image 585
Steven R Avatar asked Dec 15 '25 03:12

Steven R


1 Answers

This error means that Git cannot find

To fix that, append C:\Python (or wherever you installed python) to your PATH environment variable in windows (control panel > System).

Once you set it up test the hook again.


Another option is to create a .bashrc file in your %USERPROFILE% directory and set the variable there:

export PATH=/c/Python:$PATH

Again - check to see that it fixed the problem.

like image 146
CodeWizard Avatar answered Dec 16 '25 18:12

CodeWizard



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!