2 title: "gitweb - a GitHub/GitLab alternative"
3 date: 2022-03-24T01:29:37-04:00
4 tags: ["git", "development", "dev tools", "gitweb"]
8 ## Owning Your Digital Space
9 Over the last year or so I've slowly pushed further and further into the idea of
10 owning your digital space. Part of that has been re-evaluating all of the
11 services online that I think of as "necessary". One of these such services has
14 The more I dive into development processes the more I find that they are all
15 centered around the idea that in order for you to be a "developer" it mostly
16 requires that you buy into the idea of centralized forges like GitHub/GitLab.
17 But these very ideas make it harder and harder to actually get work done. All
18 development over the last few years has been about dealing with changes that
19 GitHub has brought about. Don't get me wrong - GitHub really does have some
20 wonderful services and they've done a lot for visibility and getting people
21 involved in OS projects.
23 But they definitely shouldn't be the only game in town.
25 In an attempt to take some control back from the major forges, I've been
26 experimenting with a small tool called gitweb.
29 gitweb is a very simple tool - it allows you to browse all the git repositories
30 within a specified folder. You simply install gitweb, point nginx over to it,
31 and edit a single configuration file. You immediately get
32 - A browser for all local git projects
33 - A tree view for your repos with raw file previews
34 - Commit history w/ colorized diffs
36 - RSS feed tracking commit history
37 - Search (with regex) throughout your repos
39 For personal projects, or even for small collaborative projects gitweb provides
40 more than enough functionality.
42 The two features that I think are missing from gitweb are Issue Tracking and
43 Merge Requests. I don't think these are necessarily features that have any place
44 in gitweb itself, but it means as a replacement for a centralized forge today,
45 you probably need to rely on additional tooling.
49 Actually setting up gitweb was surprisingly easy.
53 sudo apt install gitweb
56 ### Configuring gitweb
57 The gitweb configuration file is located at `/etc/gitweb.conf`. Installing
58 gitweb automatically populates this file with some of the defaults. It's a very tiny
59 file and honestly you don't need to touch most of it to get going. The only
60 thing that's required is setting the `$projectroot`.
63 $projectroot = "/path/to/gitfolders";
67 Most of the tutorials about getting gitweb going seem to be primarily apache
68 related. I haven't personally used apache in close to 10 years now - mostly
69 living in nginx land. Here's a very short snippet to get your nginx config going
70 to actually serve gitweb.
74 server_name git.xangelo.ca;
76 root /usr/share/gitweb/;
77 include fastcgi_params;
79 fastcgi_param SCRIPT_NAME $uri;
80 fastcgi_param GITWEB_CONFIG /etc/gitweb.conf;
81 fastcgi_pass unix:/var/run/fcgiwrap.socket;
85 root /usr/share/gitweb/;
90 All the paths included are the default locations of things gitweb configures.
91 The entire block should work for you if you just change the `server_name`
94 ## Further Customizing
95 Unfortunately not all the configuration options are specified in the
96 configuration file that's generated. Reading the source will get you a list
97 pretty quick but if you don't feel like it, here's a few other params I changed
101 # sets the title in the <title></title> html tag
102 $site_name = "My Site";
104 # by default the root of your gitweb is called "projects".
105 # I simply changed that to Home and explicitly set the url
106 # that users get directed to when they click it
107 $home_link_str = "Home";
108 $home_link = "https://git.xangelo.ca";
110 # There's a small "Header" section above the project listing
111 # that you can customize with whatever text you want. This
112 # allows you to specify an html file that should be used
114 $home_text = "/path/to/file.html";
116 # since all of these repos are mine, I don't list the owner
117 # so I've disabled this prop
122 - Git Docs: https://git-scm.com/docs/gitweb.html
123 - Gitweb Source: https://repo.or.cz/w/git.git/tree/HEAD:/gitweb/
124 - My projects: https://git.xangelo.ca