git repository with apache on ubuntu server only .git paths – Problems with loading a website are often blamed on the Internet connection, but even the most perfectly set up network cannot help if there is no service to reply at your destination. One of the most popular HTTP servers used for this task is Apache2. Much of Apache’s popularity can be attributed to its easy installation and use, but never the less it is possible to run into problems with even the easiest of the software. If you’ve encountered an issue loading your web page, follow these simple troubleshooting methods outlined in this guide to attempt to get your web server back up and working again. Below are some tips in manage your apache2 server when you find problem about apache-2.2, ubuntu, git, , .
I have an ubuntu server, running apache2. I’m trying to set it to serve 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/ SetEnv GIT_HTTP_EXPORT_ALL ScriptAlias /git/ /usr/lib/git-core/git-http-backend/ <Location /git> </Location>
I 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
Now, 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
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 works.
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?
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.
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/ SetEnv GIT_HTTP_EXPORT_ALL ScriptAlias /git/ /usr/libexec/git-core/git-http-backend/