threads / discuss / 25053

Re: Git with http and no Dav?

Subject: Re: Git with http and no Dav?

## tl;dr

One message between Sep 9, 2010 and Sep 9, 2010.

replies: 0people: 1as markdown or json

Jeremiah Foster· Sep 9, 2010, 09:47 UTC · lore
> Hi all!
> 
> I am starting to make some public repositories available, although I am struggling with the HTTP backend! 
There is an elegant solution called the http smart backend. Here's some info from Scott Chacon who wrote the Pro Git book: http://progit.org/2010/03/04/smart-http.html

That is a great link to get started, but it is a little terse. Here is some more info on the http backend: http://www.kernel.org/pub/software/scm/git/docs/git-http-backend.html

Show 6 quoted lines
> 
> My setup is currently this: authorized users make use of ssh in order to clone/push, and this works like a charm. A public view (only view!) of repositories can be obtained by gitweb, and this also works flawlessly. 
> 
> On my debian server though, I don't know how to enable public cloning via http, since I don't really want to use WebDAV, as explained on the "setup-git-server-over-http.txt" howto. 
> 
> As suggested, I issued the "git update-server-info" command in the repository location, however, this has no effect on the repository:
If you want to use the http backend, you'll need to reconfigure your apache configuration. Specifically what you'll need to do is re-map the calls to git so that they go instead to the http backend which will do all the heavy lifting. 
Here's an example; 
    SetEnv GIT_PROJECT_ROOT /srv/git
    AliasMatch ^/git/(.*/objects/[0-9a-f]{2}/[0-9a-f]{38})$          /srv/git/$1
    AliasMatch ^/git/(.*/objects/pack/pack-[0-9a-f]{40}.(pack|idx))$ /srv/git/$1
    ScriptAlias /srv/git/ /usr/lib/git-core/git-http-backend/
    ScriptAliasMatch \
    "(?x)^/git/(.*/(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/libexec/git-core/git-http-backend/$1
You can see from above that what is happening is that calls to the git objects are getting caught and then passed, via script alias, to the git-http-backend program.
Also note that this particular snippet says nothing about authentication or authorization - those are things you'll need to configure as well, perhaps with but also possibly without ssh. The http backend gives you great flexibility and allows you to replace ssh key management with a more centralized authentication mechanism.
If you read those two URLs I presented, that should give you a good start on your way. 
Regards,
Jeremiah

← back to recent threads