install cgit on DreamHost by Andrew Codispoti (support my work)
Published: Wed, Nov 3, 2021; Updated: Mon, Mar 14, 2022
Reading time: 1 minute(s) (200 words)
License: CC BY-SA 4.0 (details)


To install cgit on Dreamhost shared server:

$ git clone
$ cd cgit
$ git submodule init
$ git submodule update
$ $EDITOR cgit.conf

Edit first two lines to match your Dreamhost setup:

# cgit.conf
homedir = /home/youruser/
CGIT_SCRIPT_PATH = $(homedir)/
CGIT_CONFIG = $(homedir)/.cgitrc
CACHE_ROOT = $(homedir)/var/cache/cgit
prefix = $(homedir)/.local
libdir = $(prefix)/lib
filterdir = $(libdir)/cgit/filters
docdir = $(prefix)/share/doc/cgit
htmldir = $(docdir)
pdfdir = $(docdir)
mandir = $(prefix)/share/man

Save the file, then:

$ make NO_LUA=1
$ make install

Write config file:

$ $EDITOR $HOME/.cgitrc

Here’s a bare minimum content (see cgitrc.5.txt for details):

# .cgitrc
repo.desc=the master foo repository

If you’re using subdomain or the root of your web (not a subdirectory), you may want to edit an .htaccess in your web root:

# .htaccess
DirectoryIndex cgit.cgi
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) /cgit.cgi/$1 [END,QSA]
RewriteCond %{QUERY_STRING} service=git-receive-pack
RewriteRule .* - [END,F]

Additional resources: