💾 Archived View for gemini.xangelo.ca › posts › gitweb › index.gmi captured on 2023-01-29 at 15:20:04. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2022-04-28)

-=-=-=-=-=-=-

gitweb - a GitHub/GitLab alternative

← Newer: Removing the Default Font

→ Older: Code Reviews Are Failure

Owning Your Digital Space

Over the last year or so I've slowly pushed further and further into the idea of

owning your digital space. Part of that has been re-evaluating all of the

services online that I think of as "necessary". One of these such services has

been GitHub.

The more I dive into development processes the more I find that they are all

centered around the idea that in order for you to be a "developer" it mostly

requires that you buy into the idea of centralized forges like GitHub/GitLab.

But these very ideas make it harder and harder to actually get work done. All

development over the last few years has been about dealing with changes that

GitHub has brought about. Don't get me wrong - GitHub really does have some

wonderful services and they've done a lot for visibility and getting people

involved in OS projects.

But they definitely shouldn't be the only game in town.

In an attempt to take some control back from the major forges, I've been

experimenting with a small tool called gitweb.

gitweb

gitweb is a very simple tool - it allows you to browse all the git repositories

within a specified folder. You simply install gitweb, point nginx over to it,

and edit a single configuration file. You immediately get

For personal projects, or even for small collaborative projects gitweb provides

more than enough functionality.

The two features that I think are missing from gitweb are Issue Tracking and

Merge Requests. I don't think these are necessarily features that have any place

in gitweb itself, but it means as a replacement for a centralized forge today,

you probably need to rely on additional tooling.

Setting up gitweb

Actually setting up gitweb was surprisingly easy.

Installing gitweb

sudo apt install gitweb

Configuring gitweb

The gitweb configuration file is located at `/etc/gitweb.conf`. Installing

gitweb automatically populates this file with some of the defaults. It's a very tiny

file and honestly you don't need to touch most of it to get going. The only

thing that's required is setting the `$projectroot`.

$projectroot = "/path/to/gitfolders";

Configuring nginx

Most of the tutorials about getting gitweb going seem to be primarily apache

related. I haven't personally used apache in close to 10 years now - mostly

living in nginx land. Here's a very short snippet to get your nginx config going

to actually serve gitweb.

server {
  server_name git.xangelo.ca;
  location /index.cgi {
    root /usr/share/gitweb/;
    include fastcgi_params;
    gzip off;
    fastcgi_param SCRIPT_NAME $uri;
    fastcgi_param GITWEB_CONFIG /etc/gitweb.conf;
    fastcgi_pass  unix:/var/run/fcgiwrap.socket;
  }

  location / {
    root /usr/share/gitweb/;
    index index.cgi;
  }
}

All the paths included are the default locations of things gitweb configures.

The entire block should work for you if you just change the `server_name`

directive.

Further Customizing

Unfortunately not all the configuration options are specified in the

configuration file that's generated. Reading the source will get you a list

pretty quick but if you don't feel like it, here's a few other params I changed

up.

# sets the title in the </title> html tag
$site_name = "My Site";

# by default the root of your gitweb is called "projects". 
# I simply changed that to Home and explicitly set the url 
# that users get directed to when they click it
$home_link_str = "Home";
$home_link = "https://git.xangelo.ca";

# There's a small "Header" section above the project listing 
# that you can customize with whatever text you want. This 
# allows you to specify an html  file that should be used 
# in that area
$home_text = "/path/to/file.html";

# since all of these repos are mine, I don't list the owner
# so I've disabled this prop
$omit_owner = "1";

Resources

---

References

Related articles

Code Reviews Are Failure: <no value>

Git Branching Strategies: <no value>

Git Workflows Suck: <no value>

---