Skip to content

Instantly share code, notes, and snippets.

@zestime
Created February 18, 2016 04:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zestime/250bc083bcefbfec54de to your computer and use it in GitHub Desktop.
Save zestime/250bc083bcefbfec54de to your computer and use it in GitHub Desktop.
Apache configuration for Git server - Smart HTTP
SetEnv GIT_PROJECT_ROOT /opt/git
SetEnv GIT_HTTP_EXPORT_ALL
ScriptAlias /git/ /Applications/Xcode.app/Contents/Developer/usr/libexec/git-core/git-http-backend/
RewriteEngine On
RewriteCond %{QUERY_STRING} service=git-receive-pack [OR]
RewriteCond %{REQUEST_URI} /git-receive-pack$
RewriteRule ^/git/ - [E=AUTHREQUIRED]
<Files "git-http-backend">
AuthType Basic
AuthName "Git Access"
AuthUserFile /opt/git/.htpasswd
Require valid-user
Order deny,allow
Deny from env=AUTHREQUIRED
Satisfy any
</Files>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment