Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8818429
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T05:06:12+00:00 2026-06-14T05:06:12+00:00

I’m setting up a Git server on a Windows host. I have installed the

  • 0

I’m setting up a Git server on a Windows host. I have installed the latest Apache, and have it working with msysGit. I’m not using SSH at all; I can push and pull through HTTP.

Now I want to add a post-receive hook to notify my build server, but I can’t figure out how to do that. I see the sample hook scripts in the repository on the server, but I’m confused about what to do there. Do I put a Windows batch file there, named post-receive.bat, or do something else?

I’m a bit fuzzy on details of what this is all doing, but Apache is executing c:\Program Files\git\libexec\git-core\git-http-backend.exe when it sees a Git URL. Is git-http-backend.exe going to trigger the post-receive hook?

Update
I’m getting closer. Here’s my hook, in hooks/post-receive in my repo:

#!/c/Program Files/Git/bin/sh
curl http://mybuildserver:8080/job/Whazzup/build

I changed the shebang from #!/bin/sh because on Windows I don’t have that. Now in the Apache error log I get the message error: cannot spawn hooks/post-receive: No such file or directory

Incidentally, Git bash’s chmod does not seem to work. But I was able to get the permission on post-receive to rwxr-xr-x by renaming the sample file.

Update
I changed the shebang line back to #!/bin/sh, but I still get the same error in the Apache error log: error: cannot spawn hooks/post-receive: No such file or directory. As a test I opened a Git bash prompt in the hooks folder, and executed the hook with ./post-receive, and it worked.

Update
Now I’m wondering if I have a different problem. Taking VonC’s advice, I tried running Apache httpd from the command line under my own account, instead of as a service under LocalSystem. Still the same thing. Pushing and pulling work fine, but the hook doesn’t execute. Then I tried getting Apache out of the equation. From a Git bash prompt on the same computer as the repo, I did a clone (via filesystem), modify, commit, and push. But the hook still didn’t execute.

Update
OK, I had a silly problem in my hook script, but now at least it executes when I push to the repo from the same computer (via filesystem). But not when I push through Apache. Apache is now running under a regular account, and the Apache account has full control of the repository. The push works fine, but the post-receive hook doesn’t execute.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T05:06:13+00:00Added an answer on June 14, 2026 at 5:06 am

    Apache is executing c:\Program Files\git\libexec\git-core\git-http-backend.exe when it sees a Git URL. Is git-http-backend.exe going to trigger the post-receive hook?

    No, it will pass the command (clone, push, pull) to git itself.
    The post-receive hook will be executed after the push has been completed, and it is a bash (unix shell) script, as illustrated in ” post-receive hook on Windows – GIT_WORK_DIR: no such file or directory “.

    See also ” git windows post pull ” to see where you can create that post-receive script (in the .git/hooks of your repo): it has nothing to do with your http Apache service in front of the repos.


    Regarding the error message “cannot spawn hooks/post-receive: No such file or directory”, you can refer to ” msysgit error with hooks: "git error: cannot spawn .git/hooks/post-commit: No such file or directory" “:

    • The shebang must be #!/bin/sh
    • Apache must run as a regular user instead of Local System, in order to benefit from the environment variables defined for said regular user.
    • <path_to_git>\bin must be in the PATH
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have thousands of HTML files to process using Groovy/Java and I need to
I would like my Web page http://www.gmarks.org/math_in_e-mail.txt on my Apache 2.2.14 server to display
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I am reading a book about Javascript and jQuery and using one of the
this is what i have right now Drawing an RSS feed into the php,
I have a small JavaScript validation script that validates inputs based on Regex. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.