2009-10-02 77 views
3

默认情况下git instaweb需要lighttpd web服务器,而在OSX Leopard服务器上apache2是默认的服务器。Git instaweb httpd配置在OSX Leopard服务器上使用apache2

加入以下的.git /配置:

[instaweb] 
local = true 
httpd = apache2 -f 
port = 4321 
modulepath = /usr/libexec/apache2 

,并在运行 'git instaweb' 结果:

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

我应该如何设置.git/config把它用我的默认的Web服务器?

感谢

+0

我找不到任何解决这个问题为止。最好的转换工作是使用另一个支持服务器: httpd = webrick – Peiniau 2009-10-05 10:35:02

回答

1

如果你看看这个git-instaweb patch from February 2009,你会看到:

# 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." 
fi 

有一个问题,您的Apache2可执行属性?


更新2014(5年以后):一个commit like f8ee1f0显示混帐instaweb不仅suports的Apache,但它支持的Apache 2.4:

检测可用的Apache的MPM和使用第一个可用的根据优先顺序如下:

  • mpm_event
  • mpm_prefork
  • mpm_worker

Thomas Okkenanswer(upvoted)详述如何引用HTTPS用于开始GIT-instaweb。

+0

也许。 Apache已经在这台服务器上运行。如果我为'httpd'更改'apache2',我会得到'未知的httpd指定:httpd'。 – Peiniau 2009-10-02 13:31:28

2

原因是apache2在OS X中被命名为httpd,并且模块在别的地方。我试图改变配置,使其指向正确的路径,但仍然无法正常工作。

或者,您可以使用已安装的webrick守护进程。这些行添加到您的〜/的.gitconfig文件(全局设置)或git的/ config文件(本地设置):

[instaweb] 
       httpd = webrick 
+0

这就是我在评论中已经提到的内容。 – Peiniau 2009-11-05 09:58:51

1

我混帐instaweb与内置Apache在我的Mac(运行狮子工作)如下:

  1. 作为根:
    cd /usr/sbin; ln -s httpd apache2
  2. 作为根:编辑的/ usr /的libexec/git的核/ GIT-instaweb:添加这些行
    LockFile "$fqgitdir/gitweb/$httpd_only/access.lock" 
    User UsernameForYourGitServer
    行之后
    PidFile "$fqgitdir/pid"
  3. 最后,如你的git用户,cd到您的存储库,然后运行
    git instaweb --httpd apache2 -m /usr/libexec/apache2

这甚至适用于您已经使用标准服务器的情况,即当您打开“Web共享”时。 gitweb服务器将是一个单独的进程,监听端口1234,而不是标准服务器使用的端口80。

要使用的launchd启动该服务器上创建一个文件/Library/LaunchDaemons/git-web.plist,就像这样:

 <?xml version="1.0" encoding="UTF-8"?> 
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> 
    <plist version="1.0"> 
    <dict> 
     <key>Label</key> 
     <string>GitWeb</string> 
     <key>WorkingDirectory</key> 
     <string>/Wherever/Your/Repository/Is</string> 
     <key>ProgramArguments</key> 
     <array> 
      <string>git</string> 
      <string>instaweb</string> 
      <string>--httpd</string> 
      <string>apache2</string> 
      <string>-m</string> 
      <string>/usr/libexec/apache2</string> 
     </array> 
     <key>KeepAlive</key> 
     <true/> 
    </dict> 
    </plist>
相关问题