Can GitoLite and Git Using LDAP and NOT SSH keys

后端 未结 1 883
南旧
南旧 2021-02-10 18:55

my firm is looking at using git and gitolite but does not want to use SSH keys and work like to use LDAP.. Can this be done??

I never seen this done.. everyplace I have

相关标签:
1条回答
  • 2021-02-10 19:40

    Yes, you can do it without any issue.

    You simply need your Apache to do the authentication part (since gitolite is only an authorization layer), and call gitolite-shell instead of git-http-backend, with REMOTE_USER set by Apache (and used by gitolite-shell).

    See a detailed example in "Git with Ldap on Ubuntu with Apache".

    The main part of the httpd.conf being:

    SetEnv GIT_PROJECT_ROOT @H@/repositories
    SetEnv GIT_HTTP_EXPORT_ALL
    SetEnv GITOLITE_HTTP_HOME @H@
    ScriptAlias /hgit/ @H@/sbin/gitolite-shell/
    SetEnv GIT_HTTP_BACKEND "@H@/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>
    

    (@H@ is just a template value, to be replaced by your path)

    0 讨论(0)
提交回复
热议问题