How can I get my git (msysgit on windows) post-commit script to invoke my python script as python rather than bash? How can I get my git (msysgit on windows) post-commit script to invoke my python script as python rather than bash? bash bash

How can I get my git (msysgit on windows) post-commit script to invoke my python script as python rather than bash?


The first line of a script is called a Shebang, and the only problem with it is:

Shebangs specify absolute paths to system executables; this can cause problems on systems which have non-standard file system layouts.
Even when systems have fairly standard paths, it is quite possible for variants of the same operating system to have different locations for the desired interpreter.

The only other way would be to call python directly within your script

 #!/bin/sh C:/apps/Python25/python c:/myfolder/myscript.py

Either way, forward slashes are in order: this is a bash session which is used to execute Git and its hooks.
The interest of calling directly the python interpreter would be to replace it by an environment variable:

 #!/bin/sh $PYTHON_HOME/python $SCRIPT_FOLDER/myscript.py


Adding the following, the path to my python interpreter, as the first line of my python script worked:

#!C:/apps/Python25/python

Are there better ways?