publishing multiple git repos with gitweb

3.1k Views Asked by At

Have just started using git. Building and installing it was easy. Then I went into the directory of one of my web projects and added a git repo to it.

$ cd ~/Sites/webapp
$ git init (and so on)

I also set up gitweb, and when I added ~/Sites/webapp to $projectroot setting in gitweb.cgi, that appeared in my browser when I went to http://localhost/gitweb/gitweb.cgi

My question is thus -- from what I understand, git doesn't have a central repo concept. Every project that I may be working on will have its own git repository. Since my projects are all over my hard disk, their respective repos are also all over the hard disk. How do I add multiple repositories to gitweb? Is there some kind of central registry of all my repos? Should I really rejig how I work, and move all my projects to a central directory? How is this done?

2

There are 2 best solutions below

0
On

I do this by creating an empty repository and linking to the repositories I want to browse. This workaround is necessary because of the complicated way instaweb runs gitweb and sets the project root.

git init instaweb
cd instaweb
ln -s ~/projects/gitproj1 gitproj1
ln -s ~/projects/gitproj2 gitproj2
git instaweb --httpd webrick

The server is up and running now and the homepage will list a .git project (which is the empty repository you just initialised) along with the two actual projects you linked to.

2
On

Better late then never I guess.

I solved it by creating a project root directory and linking the git repositories.

project_root="/opt/gitweb"

In /opt/gitweb

ln -s ~/Sites/webapp webapp.git
ln -s ~/someotherplace/whereitis/application appliation.git