Blog indexRollingšŸ„ŽblogPermalink

Setting up cgit

Jake Thoughts ā€” 07 Feb 2022 04:09:04 -0500

Setting up cgit is very easy. The only reason why I didn't before was because I had this crazy idea that somehow setting up software for gitting would be 'hard'.

As always, actually installing it, configuring* it, and using it is very very easy.

Anyway, it is possible to access my personal git page by navigating to git.jakesthoughts.xyz. Gemini bros, I don't have a location for you, my apologies. ... I've seen git repos on Gemini and they always seem goofy to me. I am not against adding a git repo for Gemini but I've started to hit a limit on how much memory this VPS can spare, 512MB (or 473.1MiB)... and I have 8.5MiB free as of this very moment. Big yikes. cgit is a CGI script so it runs every time someone access the domain meaning it only uses memory when it needs to. It is also written in C which helps.

Ok, I added a '*' next to configuring. Most likely, you want syntax highlighting and about tab/page right?

This part is not so straight forward. Let me be clear on this: in '/etc/cgitrc' the order of things matter. 'source-filter=' should be above 'scan-path='. And the 'about-filter=.../about-formatting.sh'... 'readme=' affects what script it will `exec` based on the file ending.

So if you decide that the about page should reflect the contents, of say, README.md then make sure the script that gets `exec` can actually run! I, for instance, had to install pip and use pip to install the markdown module.

Reading the man page helped to identify that 'clone-url' is what people would use to clone your repos.

/etc/cgitrc
css=/cgit-css/cgit.css
logo=/cgit-css/cgit.png
enable-http-clone=1
virtual-root=/
readme=:README.md
about-filter=/usr/lib/cgit/filters/about-formatting.sh
enable-blame=1
clone-url=https://$HTTP_HOST/$CGIT_REPO_URL

source-filter=/usr/lib/cgit/filters/syntax-highlighting.sh
scan-path=/srv/git/

The reason I use /srv/git as the scan-path is because I symbolically linked to a directory in the home of a regular user. I could do this for any user and they would show up on the cgit index page.

To see what themes are available for the syntax highlighter, try '$ ls /usr/share/highligh/themes'. I am currently using 'peaksea'. Enable it with the '--style' flag.

SSH git tricks

The easiest way that I've found to use git:

Server: in the git directory, in my case ~/dev/,

  • $ mkdir git-repo
  • $ cd git-repo
  • $ git init --bare

Local: change directory as appropriate, $ ssh git clone ssh://username@remote-server:/home/username/dev/git-repo'

Suddenly, everything is set up for you. When you decide that it is time to push to the server:

  • $ git add .
  • $ git commit
  • $ git push

This is the easiest way that I've found to do gitting.

There is probably an easier way of doing it all. I am still new to gitting in general.


Other thoughts

Jake on 2022-03-01,15:03:28 said:

seems the hilighter.sh doesn't like raku so I've gone over to the python script https://pygments.org/styles/ I am using the one called murphy

Due to abuse (the comments you see now are not abuse), commenting will be disabled for sometime. Send an email or something.