制作VirtualMin git模块SMART

我使用VirtualMin的git模块在我的一台服务器上通过httpbuild立一个私有的git。 我有其他的服务器与SSH混帐,但这是我第一次尝试通过HTTP和VirtualMin设置它。

不幸的是,在过去的几个小时里,我发现默认的VirtualMin的模块不使用智能HTTP模式,并且在DAV上推送提交到服务器的提交。 我不是很喜欢。

此外,我试图把我的旧回购这个服务器,我不能使用它们,因为没有/ info / ref文件。 (我也听说使用智能http模式,我不需要这个文件)

结果,我试图find一个关于安装智能git http的文件,并发现了很多。 但我不认为他们中的任何一个与VirtualMin或其默认的git模块兼容,

你们有没有人知道我需要如何定制我的git的安装和Apache设置使用智能http协议,对VirtualMin有一点伤害,并且仍然是VirtualMin兼容?

我真的不希望我的设置和configuration在VirtualMin更新或设置的这个控制面板通常做的娱乐过程之后被移除。

请与我分享你对这个问题的想法。 谢谢

操作系统:CentOs 6.5 x64

从Virtualmin上为Git设置智能HTTP 。


从这里开始 ,解决scheme是使用git-http-backend可执行文件从普通的HTTP切换到智能HTTP,它可以执行所有的钩子,而且据推测它也快得多。

  1. 将git-httpd-backend可执行文件复制到/ home / domain / cgi-bin /目录并将权限设置为domain:domain。 这是为了避免suexec问题。

    $ cp /usr/libexec/git-core/git-http-backend /home/domain/cgi-bin $ chown domain:domain /home/domain/cgi-bin/git-http-backend 
  2. /etc/httpd/conf/httpd.conf ,将此添加到该域的VirtualHost:

     [...] ServerName domain.com [...] # Set the root directory where git repositories reside SetEnv GIT_PROJECT_ROOT /home/domain/public_html/git # By default, the git-http-backend allows push for authenticated # users and this directive tells the backend when a user is authenticated. SetEnv REMOTE_USER=$REDIRECT_REMOTE_USER # Export all repositories SetEnv GIT_HTTP_EXPORT_ALL ScriptAlias /dev/ /home/domain/cgi-bin/git-http-backend/ [...] # Add this if it's not already there DAV on AuthType Basic AuthName domain.com AuthUserFile /home/domain/etc/git.basic.passwd Require valid-user Satisfy All RedirectMatch ^/git(/+)$ /git/gitweb.cgi RewriteEngine off AddHandler cgi-script .cgi [...] 
  3. 然后重新启动apache。 现在所有的回购http://[email protected]/dev/git/*都可以在http://[email protected]/dev/git/* ,例如http://[email protected]/dev/git/reponame.git ,所有的挂钩都会执行如预期。

outlook未来,当您通过Virtualmin创build新的回购时,您需要执行以下手动步骤:

  1. 创build一个空文件/home/domain/public_html/git/reponame.git/git-daemon-export-ok

  2. 创build这个/home/domain/public_html/git/reponame.git/hooks/post-receive并使其可执行的所有,并由Apache所有:域:

     #!/bin/sh # # An example hook script for the "post-receive" event. # # The "post-receive" script is run after receive-pack has accepted a pack # and the repository has been updated. It is passed arguments in through # stdin in the form # # For example: # aa453216d1b3e49e7f6f98441fa56946ddcd6a20 68f7abf4e6f922807889f52bc043ecd31b79f814 refs/heads/master # # see contrib/hooks/ for a sample, or uncomment the next line and # rename the file to "post-receive". # Echo to the client that you're sending the mail now echo "Sending notification email..." . /usr/share/git-core/contrib/hooks/post-receive-email # Make sure to update the git repo info on the server for pulls by other clients git update-server-info echo "Updated server info." 
  3. 按照这个链接 ,设置git目录的权限如下,以避免在提交新文件时写入权限问题(同时确保gitweb.cgi脚本只能由所有者写入,以避免suexec错误出现在/etc/httpd/logs/suexec.log):

     $ cd /home/domain/public_html/git/ $ chmod -R g+ws * $ chgrp -R domain * $ chmod -R gw gitweb.cgi $ chmod -R gs gitweb.cgi 
  4. 更新/home/domain/public_html/git/reponame.git/config以匹配以下内容:

     [core] repositoryformatversion = 0 filemode = true bare = true [hooks] mailinglist = [email protected], [email protected] envelopesender = [email protected] emailprefix = "[REPONAME] "