3

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?

Steven R
  • 323
  • 2
  • 6
  • 18
  • Does `Github Windows client` comes with python? – gdlmx Apr 25 '16 at 21:20
  • No it does not. I already had it installed – Steven R Apr 26 '16 at 13:43
  • @stevenR did you ever figure out what was going on / how to fix this? Thanks! – mcheah Feb 09 '18 at 21:42
  • @mcheah This was a really long time ago, but I believe what i had to do to make it work for Github Desktop for windows was run a python script, instead of the actual code. But that means that you have to have Python installed on the computer. I am not 100% certain of this being that it was such a long time ago. – Steven R Feb 19 '18 at 18:44
  • Open git bash (Ctrl+`), type "python", follow the instructions for installing from the Microsoft Store. Then deal with the weird issue of the sqlite3 DLL not being found: https://stackoverflow.com/a/55642416/13697228. If you're using a conda environment, read the comments to the answer as well. – Sterling Oct 23 '21 at 22:51

1 Answers1

1

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.

CodeWizard
  • 128,036
  • 21
  • 144
  • 167