This is * #!/bin/sh not #!/bin/bash. I added an example to this blog post. You can download it and check that this will work on Windows too: git-hooks-example
I didn't claim it was bash. The Windows command line interpreter definitely cannot run arbitrary sh scripts, which are a Unix standard. Let alone certain basic commands - for example cp is for copying files on Unixoids, but copy must be used on Windows. It's interesting that your script runs on Windows. I see two possible explanations: Either your script is so parsimonious that its syntax is valid both in sh and on Windows. Or somehow Git, or your Git installation, brings sh with it. It would be interesting to figure out if the second explanation is true. It would also be interesting to know if, for example, you could use the cp command on Windows from a sh script like yours above.
you can if you install winbash, which is different from msysgit bash in that winbash actually treats windows paths as windows paths, where as msysgit bash mutates them to some virtual-path-that-like-linux-but-not-really-linux.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
This is *
#!/bin/sh
not#!/bin/bash
. I added an example to this blog post. You can download it and check that this will work on Windows too: git-hooks-exampleI didn't claim it was
bash
. The Windows command line interpreter definitely cannot run arbitrarysh
scripts, which are a Unix standard. Let alone certain basic commands - for examplecp
is for copying files on Unixoids, butcopy
must be used on Windows. It's interesting that your script runs on Windows. I see two possible explanations: Either your script is so parsimonious that its syntax is valid both insh
and on Windows. Or somehow Git, or your Git installation, bringssh
with it. It would be interesting to figure out if the second explanation is true. It would also be interesting to know if, for example, you could use thecp
command on Windows from ash
script like yours above.you can if you install winbash, which is different from msysgit bash in that winbash actually treats windows paths as windows paths, where as msysgit bash mutates them to some virtual-path-that-like-linux-but-not-really-linux.