Pushing to private gitserver with gitlist

1k Views Asked by At

I set up a git server on a Debian system and installed gitlist to view the repositories. All that works really fine, I can see my repositories and clone and push them over HTTP.

My Problem is that the URL to push the repositories isn't the same as the gitlist URL. Right now I can access gitlist via http://<IP>/gitlist/ and a repository like this http://<IP>/gitlist/example.git

When I want to clone/pull/push them I have to use http://<IP>/git/example.git (That's configured in apache)

SetEnv GIT_PROJECT_ROOT /home/git/repositories
SetEnv GIT_HTTP_EXPORT_ALL
ScriptAlias /git /usr/lib/git-core/git-http-backend

But I already saw systems running gitlist where you can simply copy the URL from your Browser and use it for git too.

So my Question is, how do I set up apache and gitlist that I can use the URL from the Browser to clone a repository and so on. (git clone http://<IP>/gitlist/example.git)

1

There are 1 best solutions below

0
Georg On BEST ANSWER

You have to change your apache configuration.

Rewrite the ScriptAlias that the gitlist is not touched, but git commands can access the data they need (like info/refs)

Here is my git.conf (under debian inside /etc/apache/conf.d/):

SetEnv GIT_PROJECT_ROOT /home/git/repositories
SetEnv GIT_HTTP_EXPORT_ALL
ScriptAliasMatch /gitlist/(.*/(HEAD|info/refs|objects/(info/[^/]+|[0-9a-f]{2}/[0-9a-f]{38}|pack/pack-[0-9a-f]{40}\.(pack|idx))|git-(upload|receive)-pack)) /usr/lib/git-core/git-http-backend/$1

(Note: you're not using ScriptAlias but ScriptAliasMatch to use regex)