Git instaweb httpd configuration to use apache2 on OSX Leopard server

By default git instaweb is expecting lighttpd web server, whereas on OSX Leopard server apache2 is the default one.

Adding the following to .git/config :

  • git ~/.config/git/config not reading
  • Heroku error: “Permission denied (public key)”
  • What is the syntax in .git/config to use Linux line endings in a Windows repository?
  • Is there a way to override a git author's display name in local repository config?
  • Build project imported from Eclipse git as Android Project
  • How to use git (git config --global)?
  • [instaweb]
    local = true
    httpd = apache2 -f
    port = 4321
    modulepath = /usr/libexec/apache2

    and running ‘git instaweb‘ results in :

    apache2 not found.  
    Install apache2 or use --httpd to specify another httpd daemon.

    How should I set up .git/config to have it use my default web server ?


  • Calling git from scheduled batch file
  • Pulling remote into subdirectory
  • How to know if a Git tag has been moved?
  • Can't delete local git branch
  • gitignore won't ignore my .settings/ directory (created by eclipse)
  • git commit command with core.editor equals atom
  • 3 Solutions collect form web for “Git instaweb httpd configuration to use apache2 on OSX Leopard server”

    The reason is that apache2 is named httpd in OS X, and the modules are somewhere else. I have tried changing the configuration so that it points to the correct paths, but still the server didn’t work.

    Alternatively, you can use the already installed webrick daemon. Add these lines to your ~/.gitconfig file (global setting) or .git/config file (local setting) :

                   httpd = webrick

    I got git instaweb to work with the built-in Apache on my Mac (running Lion) as follows:

    1. As root:
      cd /usr/sbin; ln -s httpd apache2
    2. As root: edit /usr/libexec/git-core/git-instaweb: add the lines
      LockFile "$fqgitdir/gitweb/$httpd_only/access.lock"
      User UsernameForYourGitServer

      after the line

      PidFile "$fqgitdir/pid"
    3. Finally, as your git user, cd to your repository, and run
      git instaweb --httpd apache2 -m /usr/libexec/apache2

    This even works when you are already using the standard server, i.e. when you have “Web Sharing” turned on. The gitweb server will be a separate process, listening on port 1234, rather than port 80 which is used by the standard server.

    To launch this server using launchd, create a file /Library/LaunchDaemons/git-web.plist, like so:

        <?xml version="1.0" encoding="UTF-8"?>
        <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
        <plist version="1.0">

    If you look at this git-instaweb patch from February 2009, you see:

    # check if server can be executed
    httpd_only="$(echo $httpd | cut -f1 -d' ')"
    if ! type $httpd_only >/dev/null 2>&1; then
      echo >&2 "$httpd_only not found. Install $httpd_only or use" \
               + "--httpd to specify another httpd daemon."

    Is there a problem with your apache2 executable attribute?

    Update 2014 (5 years later): a commit like f8ee1f0 shows that git-instaweb not only suports Apache, but it does support Apache 2.4:

    Detect available Apache MPMs and use first available according to following order of precedence:

    • mpm_event
    • mpm_prefork
    • mpm_worker

    Thomas Okken’s answer (upvoted) details how to reference https for starting git-instaweb.

    Git Baby is a git and github fan, let's start git clone.