2011-11-05 57 views
3

我想在我的Debian服務器上設置git。然而,我對這個智能HTTP的東西感到瘋狂,因爲我想用eclipse的Egit插件,它需要智能HTTP。爲此,我無法將我的本地分支推送到我的服務器上的遠程存儲庫。我已經安裝了Apache和Git 1.7.2.3。我正在使用基本身份驗證,並啓用了mod_cgi,mod_envmod_alias。對於混帳東西,我的Apache配置文件位於/etc/apache2/sites-available/git,擁有大約下列內容:Git,Debian,Apache和智能HTTP

<VirtualHost *:80> 
     Servername git.mydomain.com 
     DocumentRoot /var/git 
     SetEnv GIT_PROJECT_ROOT /var/git/ 
     SetEnv GIT_HTTP_EXPORT_ALL 
     ScriptAlias /git/ /usr/lib/git-core/git-http-backend/ 
     <Directory "/var/git"> 
      DAV On 
      Options +Indexes +FollowSymLinks 
      Deny from all 
      AuthType Basic 
      AuthName "git repository" 
      AuthUserFile /var/git/.htpasswd 
      AuthGroupFile /var/git/.htgroup 
     </Directory> 
     <Directory /var/git/allternative> 
       Allow from all 
       Order allow,deny 
       Require group allternative 
     </Directory> 
     <Directory "/usr/lib/git-core/git-receive-pack"> 
       Allow from all 
       Order allow,deny 
       Require group allternative 
     </Directory> 
</VirtualHost> 

的diretories如下:

  • /var/git:這是我的所有存儲庫將是目錄
  • /var/git/allternative:這是所在的目錄(裸)庫撒謊說我目前正在試圖建立

我做了我在這篇文章上閱讀的所有內容(和許多其他人說的一樣):http://progit.org/2010/03/04/smart-http.html

我仍然從Egit得到遠程智能HTTP未啓用的錯誤。我錯過了什麼?

由於提前, 安德烈亞斯

回答

4

回答我的問題: 我更換了ScriptAlias指令與此:

ScriptAliasMatch \ 
    "(?x)^/(.*/(HEAD | \ 
     info/refs | \ 
     objects/(info/[^/]+ | \ 
      [0-9a-f]{2}/[0-9a-f]{38} | \ 
      pack/pack-[0-9a-f]{40}\.(pack|idx)) | \ 
       git-(upload|receive)-pack))$" \ 
       "/usr/lib/git-core/git-http-backend/$1" 

,也加入以下指令:

SetEnv REMOTE_USER=$REDIRECT_REMOTE_USER 

然後有效。我在http://www.espace.com.eg/blog/2010/11/10/migrating-from-subversion-to-git/上發現了這兩個設置,我不確定哪一個解決了問題,但我認爲這是SetEnv REMOTE_USER=$REDIRECT_REMOTE_USER指令。

3

ServerAdmin  [email protected] 
ServerName  git.server.ru 
ServerAlias  git 
UseCanonicalName Off 

# path to repo 
DocumentRoot /srv/git 
DavLockDB "/var/lock/davlock" 

SetEnv GIT_PROJECT_ROOT /srv/git 
SetEnv GIT_HTTP_EXPORT_ALL 
#in Progit http://progit.org/2010/03/04/smart-http.html next line is omitted and 
#we get an error. So next line is a mandatory requirement. 
SetEnv REMOTE_USER=$REDIRECT_REMOTE_USER 

#Don't uncomment line below. It's a second error. 
#ScriptAlias//usr/lib/git-core/git-http-backend/ 

#but this works 

ScriptAliasMatch \ 
    "(?x)^/(.*/(HEAD | \ 
      info/refs | \ 
      objects/(info/[^/]+ | \ 
       [0-9a-f]{2}/[0-9a-f]{38} | \ 
        pack/pack-[0-9a-f]{40}\.(pack|idx)) | \ 
        git-(upload|receive)-pack))$" \ 
        "/usr/lib/git-core/git-http-backend/$1" 

#making accessible scripts 
    <Directory /usr/lib/git-core/> 
     Options +ExecCGI 
    Order Allow,Deny  
    Allow from all 
    </Directory> 

#opening access to our git repos 
<Directory /srv/git> 
Dav on 
Order Allow,Deny   
Allow from all 
Options +Indexes      
</Directory> 

#need only for auth. 
<LocationMatch "^.*/git-receive-pack$"> 
    AuthType Basic 
    AuthName "Git Access" 
    AuthUserFile /srv/git/passwd.git 
    Require valid-user 
</LocationMatch> 

LogLevel warn 
ErrorLog /var/log/httpd/git-error.log   
CustomLog /var/log/httpd/git-access.log combined