Git Server Side Hook using C#

With subversion and VisualSVN I was able to put a .net binary file as the hook using c# and building the assembly. You just put a file called Post-Commit.exe in the hook folder and it works.

With git I am guessing because it is running thorugh cygwin and it basically through a linux type of vm, it would have to be an executable that would run on linux?

The reason i went with c# and a .net binary is that is my primary coding language I use and it was easier and faster to do what I was trying to do.

Actually what was being done with subversion is after someone commits to the repository it checked to see if the trunk folder of the repository was updated, if it was it then turned around and checked out a copy of the repository (or updated if it is already checked out). It then runs a free program found on the web called ftpsync that syncs the repository with a web server. (Really it only checked out the view folder and not the code files, they are mvc.net sites) I am not sure I can switch to git quite yet as it doesn't appear like it is as mature as Subversion is at least on the windows platform. I have looked at GitSharp but that appears to be a lot of work and really isn't production code.

This is idea as I don't have to give people access to the webserver for them to update, all I have to do is give them access to the trunk folder of the subversion project and it also forces developers to use the version control system instead of bypassing it and directly updating the web server.

thanks for any help or direction

Also as other notes the ftpsync is a windows executable to being run from the .net binary as a seperate thread so that you can get a response back from a commit to subversion without waiting on the ftpsync program to finish as sometimes it can take a while.


Why not just have a checkout on your web server, setup your central server as the origin/master, and do a git pull via cron/scheduled task?

Obviously you should use a user on your origin that only has read-only access, and configure your webserver to deny access to the .git dir in some way (either htaccess or via file permissions).