2013-10-15 26 views

回答

4

是的,你可以做到這一點沒有任何問題。

您只需你Apache to do the authentication part(因爲gitolite只是一個authorization layer),並調用gitolite-shell代替git-http-backend,與REMOTE_USER阿帕奇設定(和used by gitolite-shell)。

請參閱「Git with Ldap on Ubuntu with Apache」中的詳細示例。

httpd.conf存在的主要部分:

SetEnv GIT_PROJECT_ROOT @[email protected]/repositories 
SetEnv GIT_HTTP_EXPORT_ALL 
SetEnv GITOLITE_HTTP_HOME @[email protected] 
ScriptAlias /hgit/ @[email protected]/sbin/gitolite-shell/ 
SetEnv GIT_HTTP_BACKEND "@[email protected]/usr/local/apps/git/libexec/git-core/git-http-backend" 
<FilesMatch "\.(cgi|shtml|phtml|php)$"> 
    SSLOptions +StdEnvVars 
</FilesMatch> 
<Location /hgit> 
    SSLOptions +StdEnvVars 
    Options ExecCGI +FollowSymLinks +SymLinksIfOwnerMatch 
    #AllowOverride All 
    order allow,deny 
    Allow from all 
    AuthName "LDAP authentication for Smart HTTP Git repositories" 
    AuthType Basic 
    AuthBasicProvider myldap companyldap 
    AuthzLDAPAuthoritative Off 
    Require valid-user 
    AddHandler cgi-script cgi 
</Location> 

@[email protected]只是一個模板值,由你的路徑來代替)

+0

但這個貌似每個人都將有機會獲得的一切..如何gitolite會在這個設置中使用 – JMSAZ2013

+0

@ JMSAZ2013否,看起來並不是每個人都可以訪問所有內容。首先,您必須驗證自己('需要有效用戶'),否則您將無法訪問任何回購。第二'gitolite-shell'被稱爲( 「'的ScriptAlias/hgit/@ H +/sbin目錄/ gitolite殼/'」),用你的ID在'REMOTE_USER'變量設置:如果gitolite發現你無權訪問一個特定的回購,它會發回一個403錯誤(訪問被拒絕)。 – VonC