2011-12-05 14 views
1

我的設置是:
1.用於Git存儲的OS X runnig apache服務器。
2.我對Git的項目目錄是在這裏:/庫/ Web服務器/文件/ CI
3.我已經按照這個教程:http://www.pkgbox.org/wordpress/2011/08/setting-up-a-git-server-on-macos-x-lion/和設置好的了通過HTTP的Git訪問
4.我gitrepo.conf是這樣的:
在OS X中通過HTTP進行Git post-receive

DavLockDB "/var/www/DavLock/Lock" 
DavMinTimeout 28800 

<Directory /Library/WebServer/Documents/CI> 
    DAV On 
    Deny from all 
    AuthType Basic 
    AuthName "Area51 git repositories" 
    AuthUserFile /etc/apache2/other/htpasswd-git 
    AuthGroupFile /etc/apache2/other/htgroup-git 

</Directory> 
<Directory /Library/WebServer/Documents/CI/ci_test.git> 
Allow from all 
Order allow,deny 
Require valid-user 
<Limit GET> 
Require group myproject-reader 
</Limit> 
<Limit GET PUT POST DELETE PROPPATCH MKCOL COPY MOVE LOCK UNLOCK> 
Require group myproject-writer 
</Limit> 
</Directory> 

5.認證通過HTTP工作,我有不同的用戶和不同的羣體,這是所有工作的罰款。

我的問題是: 我希望能夠在我的git中使用post-receive hook。我讀過這個問題:Git post-receive hook not working 而我從那裏得到的是,我需要設置SMART HTTP。不幸的是此鏈接: http://www.kernel.org/pub/software/scm/git/docs/git-http-backend.html GET是我404

我在這裏讀到:http://progit.org/2010/03/04/smart-http.html但我在設置服務器真正的新手,我不明白我該做的......你能提供給我有效的配置來激活GIT鉤子?

建議的解決方案 更改爲SMART HTTP。

這是我目前的gitrepo.conf

<VirtualHost *:80> 
    ServerName ciserver.smt 
    DocumentRoot /Library/WebServer/Documents/CI 

    SetEnv GIT_PROJECT_ROOT /Library/WebServer/Documents/CI 
    SetEnv GIT_HTTP_EXPORT_ALL 

    ScriptAlias//usr/libexec/git-core/git-http-backend/ 
    AliasMatch ^/(.*/objects/[0-9a-f]{2}/[0-9a-f]{38})$   /Library/WebServer/Documents/CI/$1 
    AliasMatch ^/(.*/objects/pack/pack-[0-9a-f]{40}.(pack|idx))$ /Library/WebServer/Documents/CI/$1 

    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/libexec/git-core/git-http-backend/$1 

    <LocationMatch "^/.*/git-receive-pack$"> 
    AuthType Basic 
    AuthName "Git" 
    AuthUserFile /etc/apache2/other/htpasswd-git 
    AuthGroupFile /etc/apache2/other/htgroup-git 
    <Limit GET> 
    Require group myproject-reader 
    </Limit> 
    <Limit GET PUT POST DELETE PROPPATCH MKCOL COPY MOVE LOCK UNLOCK> 
    Require group myproject-writer 
    </Limit> 
    </LocationMatch> 
</VirtualHost> 

我已經改變了/ etc/hosts中添加ciserver.smt爲指向127.0.0.1 現在,我無法做出這樣的請求:

git clone http://[email protected]/ci_test.git 

我越來越:

error: The requested URL returned error: 403 while accessing http://[email protected]/ci_test.git/info/refs 

fatal: HTTP request failed 

什麼我還是做錯了什麼?

回答

1

看來你不能在webdav共享倉庫上運行鉤子。但是您可以使用智能HTTP協議(它通過CGI包含在Web服務器中),它可以處理掛鉤。

有關更多詳細信息,請參閱http://dev.bazingaweb.fr/2011/02/23/how-to-set-up-git-over-http.html

+0

我跟着你的粘貼鏈接(非常感謝,因爲我知道我應該遵循哪個方向)。恐怕我在這裏做錯了什麼。我將用更改的設置更新我的問題 – Ertai