ProxyPass _SERVER_PATH_PREFIX_git/ !

# see https://www.kernel.org/pub/software/scm/git/docs/git-http-backend.html for details
# needs mod_cgi to work -> a2enmod cgi
SetEnv GIT_PROJECT_ROOT "_GIT_REPOSITORIES_"

# Allow all repositories within the root to be exported
# depending on the authorization of OpenProject
SetEnv GIT_HTTP_EXPORT_ALL

# Set the remote user based on the redirect.
# If not set, receive-pack service will be disabled by default.
SetEnv REMOTE_USER=$REDIRECT_REMOTE_USER

ScriptAlias _SERVER_PATH_PREFIX_git/ "_GIT_HTTP_BACKEND_"
<Location _SERVER_PATH_PREFIX_git/>
  ErrorDocument 401 default
  ErrorDocument 403 default
  ErrorDocument 404 default

  AuthType Basic
  AuthName "OpenProject GIT"
  Require valid-user

  <IfModule !mod_authz_core.c>
    Order deny,allow
    Allow from all
  </IfModule>

  PerlAccessHandler Apache::OpenProjectAuthentication::access_handler
  PerlAuthenHandler Apache::OpenProjectAuthentication::authen_handler

  OpenProjectGitSmartHttp yes
  OpenProjectUrl '_APP_URI_'
  OpenProjectApiKey '_APP_API_KEY_'
</Location>
