Hook for post-receive not working


I have recently started using gitstack, but I cannot get Hooks to work.

I have the server and a client set up and working, i can push, pull and commit. However, since this is a web server, I want my GitStack server to upload the files to an FTP-server, using a post-receive Hook.

I have a file in GitStack\repositories\projectname.git\hooks\

the file is called post-recieve.bat and contains the code to launch another program.

However, when i push to the repo, the bat file is never called. If i just double-click it, it works fine.
If i try to execute post_receive from cmd.exe, it runs fine.
in apace logfile i get this error message: error: cannot spawn hooks/post-receive: No such file or directory
I have tried running chmod +x and chmod 777 on the post_receive file but still the same.

Also tried renaming the script to post-receive.cmd or just post-receive


the file just contains the line

e:\syncback\syncback.exe send

What can I do to get post-receive to work with gitstack?
I only have GitStack installed, no msysgit and no cygwin, but I have added GitStackgitbin to PATH

I have no idea what might be wrong, but I hope it is possible to accomplish what I am trying to do.
How can I make GitStack upload files to ftp when I push to the server?


Update: added more info

Tags: asked March 16, 2012

3 Answers

I have tried lots of different paths for shebang, but it does not seem to work. In path, I have c:/Gitstack/bin and c:/gitstack/cmd There is obviously something I am not getting... i have tried:
  • #!/c/gitstack/bin/sh echo test mkdir test
  • #!/c/gitstack/bin/bash echo test mkdir test
  • #!/bin/sh echo test mkdir test
  • #!/bin/bash echo test mkdir test
  • #!/sh echo test mkdir test
  • #!/bash echo test mkdir test
  • #!sh echo test mkdir test
  • #!bash echo test mkdir test
My recommendation is to contribute to stack overflow. GitStack is a standard installation of Git and I am almost sure that the issue is related to Git on Windows and is not specific on GitStack. This Msysgit Google Group is also exellent to post this kind of questions.

Your Answer

Please login to post questions.