gitweb - a GitHub/GitLab alternative
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
- A browser for all local git projects
- A tree view for your repos with raw file previews
- Commit history w/ colorized diffs
- Snapshot downloads
- RSS feed tracking commit history
- Search (with regex) throughout your repos
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
|
|
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
.
|
|
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.
|
|
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.
|
|
Resources
- Git Docs: https://git-scm.com/docs/gitweb.html
- Gitweb Source: https://repo.or.cz/w/git.git/tree/HEAD:/gitweb/
- My projects: https://git.xangelo.ca