Created
December 27, 2017 22:09
-
-
Save hujuice/6133989e616d3baf166c2f8c10235013 to your computer and use it in GitHub Desktop.
Dev repos Apache configuration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /path/to/repos/apache.conf | |
## Git HTTP(s) backend (aka Git Smart HTTP) and Gitweb | |
## =================================================== | |
## See https://git-scm.com/docs/git-http-backend | |
## See https://git-scm.com/book/be/v2/Git-on-the-Server-Smart-HTTP | |
## See https://git-scm.com/docs/gitweb | |
# Git over https | |
# ============== | |
SetEnv GIT_HTTP_EXPORT_ALL | |
# Blessed repository (read only) | |
# ------------------------------ | |
SetEnvIf Request_URI "^/repos/blessed" GIT_PROJECT_ROOT=/path/to/repos/blessed.git | |
ScriptAliasMatch "(?x)^/repos/blessed/( \ | |
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 | |
# Integration repository (rw, with authentication) | |
# ----------------------------------------------- | |
SetEnvIf Request_URI "^/repos/integration" GIT_PROJECT_ROOT=/path/to/repos/integration.git | |
ScriptAliasMatch "(?x)^/repos/integration/( \ | |
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 | |
# Authentication required to push | |
# ------------------------------- | |
<Files "git-http-backend"> | |
AuthType Basic | |
AuthName "Git Access" | |
AuthBasicProvider file | |
AuthUserFile "/path/to/repos/web/passwords" | |
AuthGroupFile "/path/to/repos/web/groups" | |
Require group committers | |
Require expr !(%{QUERY_STRING} -strmatch '*service=git-receive-pack*' || %{REQUEST_URI} =~ m#/git-receive-pack$#) | |
</Files> | |
# Gitweb | |
# ======= | |
SetEnv GITWEB_CONFIG /path/to/repos/gitweb.conf | |
Alias /repos /usr/share/gitweb | |
<Directory "/usr/share/gitweb"> | |
Options +ExecCGI +FollowSymLinks +SymLinksIfOwnerMatch | |
Require all granted | |
AddHandler cgi-script cgi | |
DirectoryIndex gitweb.cgi | |
</Directory> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment