Set up user access per git repo on Apache on Windows
I'm setting up git repos to be served by Apache on windows. Httpd.conf is pretty straight forward - it forwards requests to git-http-backend and tells Apache to allow access for authenticated users only. It works fine. However what is needed is the ability to specify different AuthUserFile for each repo - for RepoOne.git user usersOneGroup, for RepoTwo.git usersTwoGroup.
I tried specifying different folders within Directory (DirectoryMatch etc) directives but couldn't get it working. Is there a way to set it up? If so how?
The relevant httpd.conf section (borrowed from this post mainly):
<Directory />
AuthType Basic
AuthName "git repos"
AuthUserFile "c:\CommittersPasswords"
Require valid-user
</Directory>
SetEnv GIT_PROJECT_ROOT C:/Repositories
SetEnv GIT_HTTP_EXPORT_ALL
ScriptAliasMatch \
"(开发者_如何学JAVA?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))$" \
"C:/Program Files (x86)/git/libexec/git-core/git-http-backend.exe/$1"
Thanks
If you can live without Apache (or if you are willing to use Apache as a reverse proxy) you might see if Gitblit would work for you. Gitblit was written to be an integrated pure Java Git solution for small workgroups.
精彩评论