gitweb + smart http

As the requirements for http-type push and pull, we must set up much more things. This post is a short report for how to set it up but discard the detail of how to install the packages.

1. git-http-backend:

As the resources from manual git-http-backend, we need to generate a configuration and its corresponding settings.

# vim /{the apache configs directory}/git-more.conf

And filled out settings like:

1
2
3
4
5
6
7
8
9
10
11
12
13
SetEnv GIT_PROJECT_ROOT {git repository root}
SetEnv GIT_HTTP_EXPORT_ALL

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))$"
\
/{path to git-http-backend}/$1

ScriptAlias /git/ /{path to gitweb.cgi}/

And Don’t forget to enable the WebDav for the repositories directory, like:

1
2
3
4
5
<Directory "{repositories root}">
Options Indexes FollowSymlinks ExecCGI
Allow From All
Dav On
</Directory>

On the other hand, also the ExecCGI permission for the cgis. But there also problems when we use git push

After adding the configurations and restart the service, we can use the git clone with http protocol but receive errors while push. So the second step is to find out the reason.

We got error from client, like:

error: no DAV locking support on …

And the error message from apache error log is:

Service not enabled: ‘receive-pack’

Then the access log is:

“GET …/info/refs?service=git-receive-pack HTTP/1.1” 403 – “-” “git/1.7.1”

2. smart http:

For a long time survey, according to the page Authentication for git push over http, the answer is clear. We must set REMOTE_USER to REDIRECT_REMOTE_USER. That is, in apache configure, we need to add:

SetEnv REMOTE_USER $REDIRECT_REMOTE_USER

Then the push is work and correct.

Finally, for the gitweb, we observed that the projects are not shown and there’s no error messages of apache. As the same, for a long search, by the page Setting up your own git repository, the answer is to construct an config file for gitweb and let apache known that.

3. gitweb.conf

#echo '$projectroot = "{repository root}";' > /etc/gitweb.conf

And then add the following line in apache config:

SetEnv GITWEB_CONFIG /etc/gitweb.conf

OK. For a long trip, the server is all done. Enjoy it 😀

One Reply to “gitweb + smart http”

Leave a Reply

Your email address will not be published. Required fields are marked *