summaryrefslogtreecommitdiff
path: root/etc/httpd/conf.d/git-http-cf.conf
blob: 0d4302ec44eb48ea2229b061109d9eebd07cc9c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#
#
# Git Smart HTTP Support (readonly)
# clone/fetch ONLY

SetEnv GIT_PROJECT_ROOT /srv/git
SetEnv GIT_HTTP_EXPORT_ALL 1

# Expose git-upload-pack and info/refs.
ScriptAliasMatch "^(/.+/(git-upload-pack|info/refs))$" \
  /usr/libexec/git-core/git-http-backend$1

# No authentication needed for git clone/fetch.
<LocationMatch "^/.+/git-upload-pack$">
    Require all granted
</LocationMatch>

# Only allow info/refs for git clone/fetch.
<LocationMatch "^/.+/info/refs$">
    Require expr %{QUERY_STRING} == "service=git-upload-pack"
</LocationMatch>

# Explicitly deny git push just in case.
<LocationMatch "^/.+/git-receive-pack$">
    Require all denied
</LocationMatch>