Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm currently hosting my own git-repos for my private projects. For this, I use Apache and the standard git http-backend.

Now, a repo can be accessed under an URL like this:

With this URL, I can push, fetch and clone to/from this repo using . However, opening this URL in a Browser simply gives me a blank page and now I'm looking for a way to avoid this.

Instead, I'd like Apache to present a page with some infos like:

This is not a web-page, this is a git-repo. You can clone this repo using git clone [URL] ...

It would be nice if [URL] would be replaced with the current URL (using PHP for example), but plain HTML would be fine, too.

I know this should be possible since does the same with their repos.

I managed to do something similar for the by specifying a DocumentRoot in the VHost-config file:

DocumentRoot /srv/http/vcs/

In this path, i put a simple index.html-file with basic instructions.

So, is their any simple way of showing an info side for browsers while the git-client can still work with the repo? Can I redirect browsers to a specific info-site?

share|improve this question

Yes, that's actually relatively simple. You need to tell apache to only use the git-http-backend for things git is interested in, which is anything that matches ^.*/(HEAD|info/refs|objects/info/.*|git-(upload|receive)-pack)$

share|improve this answer
Would you elaborate? Using AliasMatch with that expression doesn't work. – GnP Aug 26 '15 at 21:02
Ok, I've figured it out and your answer was the pointer I needed. I created an AliasMatch ^/git/.*.git/$ <some_txt_file_with_basic_instructions> to handle browsers and a ScriptAliasMatch ^/git/(.*\.git/.*) /usr/lib/git-core/git-http-backend/$1 where I previously had the textbook ScriptAlias. – GnP Aug 27 '15 at 18:18

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.