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 have an ubuntu server, running apache2. I'm trying to set it to server git repository over http.

After reading tens of samples, I ended with very simplified config file, removing all of the authentication for simplicity.

My git_conf file in conf.d looks like this:

SetEnv GIT_PROJECT_ROOT /srv/repos/git/

ScriptAlias /git/ /usr/lib/git-core/git-http-backend/

<Location /git>

I have created an empty git repository like this:

# git --bare init myrepo
# cd myrepo
# git --bare update-server-info
# cd ..
# chown -R www-data:www-data myrepo

No, the fun begins. I was able to clone the repo on the local machine:

# cd ~/tmp
# git clone /my/repo/path/myrepo test1

But, whenever I try to clone from a remote machine like this:

$ git clone http://myserver/git/myrepo test1

I receive:

fatal: http://cfs-int-redmine/git/iosdemo/info/refs not found: did you run git update-server-info on the server?

If on the server I create a symlink to the repo like:

# ln -s myrepo myrepo.git

And then I try to clone http://myserver/git/myrepo.git, it work OK.

So, what's going on? Should I aways use ".git" in order to be able to use the repository? How do I make it to work without .git?

share|improve this question
up vote 1 down vote accepted

Typically any hosting will use the .git suffix. From a technical standpoint I wouldn't have expected it to be required, but it's a pretty ingrained standard at this point, and your own testing seems to verify that git does enforce this. The .git suffix on the directory name marks the directory as a git bare repository, similar to how the .git folder is used to store the git repository info in a non-bare repository.

share|improve this answer
Thanks. The problem is that it does not work. It works only with ".git". I understand the conventions, but I want to make it work w/o .git – Sunny Oct 11 '11 at 12:58
@Sunny: You asked "Should I do this?" The short answer is yes, you should follow the convention. It seems like git-http-backend is enforcing this for you too. Sound like you'll have to go hacking in there if you really do want to get this working. – Matthew Scharley Oct 11 '11 at 13:00
@Sunny: Another potential alternative (if you don't need anonymous access) is git/ssh/gitosis, which works really well together and doesn't have any file path requirements meaning you can check out over SSH from any folder on the server, including one without a .git suffix. – Matthew Scharley Oct 11 '11 at 13:02

Another solution to this problem is also making 100% sure that your ScriptAlias points to the correct git-http-backend location.

SetEnv GIT_PROJECT_ROOT /data/git/
ScriptAlias /git/ /usr/libexec/git-core/git-http-backend/
share|improve this answer

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.