php - Executing Git hooks on Windows -


i'm having trouble executing git hooks on windows. have bare repo , in it's "hooks" folder put following both "update" , "pre-push" files php script never being executed:

"c:/programs/php/php.exe" c:/data/scripts/git-pre-push.phpcli %1 

any ideas why php script isn't executed?

in git console window see following when try push bare repo:

post git-receive-pack (437 bytes) remote: error: hook declined update refs/heads/master https://myuser@mydomain/samplerepo ! [remote rejected] master -> master (hook declined) error: failed push refs 'https://myuser@mydomain/samplerepo' 

...so know "update" somehow being executed. when remove file push works fine.

by default, git windows executes hook scripts using own windows port of bash shell. certainly, unix shell has no idea %1. supposedly, git windows has hacks in place detect "common" filename extensions — such .bat — , take alternate route in such case.

i think fix own program best, approach rewrite script read

#!/bin/sh c:/programs/php/php.exe c:/data/scripts/git-pre-push.phpcli "$@" 

(the shebang line has no real special sense under windows other hinting next person edit script meaning of content).


Comments

Popular posts from this blog

assembly - 8086 TASM: Illegal Indexing Mode -

Java, LWJGL, OpenGL 1.1, decoding BufferedImage to Bytebuffer and binding to OpenGL across classes -

javascript - addthis share facebook and google+ url -