From 70e783628b1bf863da45cc8879b06288a498840b Mon Sep 17 00:00:00 2001 From: David Luevano Alvarado Date: Fri, 5 May 2023 03:16:06 -0600 Subject: update css, make articles more uniform, add toc and add functionality to scroll to the top --- live/blog/a/git_server_with_cgit.html | 48 ++++++++++++++++++++++++++--------- 1 file changed, 36 insertions(+), 12 deletions(-) (limited to 'live/blog/a/git_server_with_cgit.html') diff --git a/live/blog/a/git_server_with_cgit.html b/live/blog/a/git_server_with_cgit.html index defcf3e..3c0bcae 100644 --- a/live/blog/a/git_server_with_cgit.html +++ b/live/blog/a/git_server_with_cgit.html @@ -16,14 +16,21 @@ + + - + + + + + + @@ -73,17 +80,34 @@
+
+ +

Create a git server and setup cgit web app (on Nginx)

-

My git server is all I need to setup to actually kill my other server (I’ve been moving from servers on these last 2-3 blog entries), that’s why I’m already doing this entry. I’m basically following git’s guide on setting up a server plus some specific stuff for (btw i use) Arch Linux (Arch Linux Wiki: Git server and Step by step guide on setting up git server in arch linux (pushable)).

-

Note that this is mostly for personal use, so there’s no user/authentication control other than that of SSH. Also, most if not all commands here are run as root.

-

Prerequisites

+

My git server is all I need to setup to actually kill my other server (I’ve been moving from servers on these last 2-3 blog entries), that’s why I’m already doing this entry. I’m basically following git’s guide on setting up a server plus some specific stuff for btw i use Arch Linux (Arch Linux Wiki: Git server and Step by step guide on setting up git server in arch linux (pushable)).

+

Note that this is mostly for personal use, so there’s no user/authentication control other than that of normal ssh. And as with the other entries, most if not all commands here are run as root unless stated otherwise.

+

Table of contents

+ +

Prerequisites

I might get tired of saying this (it’s just copy paste, basically)… but you will need the same prerequisites as before (check my website and mail entries), with the extras:

-

Git

+

Git

Git is a version control system.

If not installed already, install the git package:

pacman -S git
@@ -117,11 +141,11 @@ systemctl enable git-daemon.socket
 

You’re basically done. Now you should be able to push/pull repositories to your server… except, you haven’t created any repository in your server, that’s right, they’re not created automatically when trying to push. To do so, you have to run (while inside /home/git):

git init --bare {repo_name}.git
-chown -R git:git repo_name.git
+chown -R git:git {repo_name}.git
 
-

Those two lines above will need to be run each time you want to add a new repository to your server (yeah, kinda lame… although there are options to “automate” this, I like it this way).

+

Those two lines above will need to be run each time you want to add a new repository to your server. There are options to “automate” this but I like it this way.

After that you can already push/pull to your repository. I have my repositories (locally) set up so I can push to more than one remote at the same time (my server, GitHub, GitLab, etc.); to do so, check this gist.

-

Cgit

+

Cgit

Cgit is a fast web interface for git.

This is optionally since it’s only for the web application.

Install the cgit and fcgiwrap packages:

@@ -162,10 +186,9 @@ repo.url={url} repo.path={dir_path} repo.owner={owner} repo.desc={short_description} - ... -

Where you can uncomment the robots line to let web crawlers (like Google’s) to index your git web app. And at the end keep all your repositories (the ones you want to make public), for example for my dotfiles I have:

+

Where you can uncomment the robots line to not let web crawlers (like Google’s) to index your git web app. And at the end keep all your repositories (the ones you want to make public), for example for my dotfiles I have:

...
 repo.url=.dots
 repo.path=/home/git/.dots.git
@@ -174,6 +197,7 @@ repo.desc=These are my personal dotfiles.
 ...
 

Otherwise you could let cgit to automatically detect your repositories (you have to be careful if you want to keep “private” repos) using the option scan-path and setup .git/description for each repository. For more, you can check cgitrc(5).

+

Cgit’s file rendering

By default you can’t see the files on the site, you need a highlighter to render the files, I use highlight. Install the highlight package:

pacman -S highlight
 
@@ -222,10 +246,10 @@ exec highlight --force --inline-css -f -I -O xhtml -S "$EXTENSION" 2&g -- cgit v1.2.3-70-g09d2