summaryrefslogtreecommitdiff
path: root/src/blog/a/git_server_with_cgit.md
diff options
context:
space:
mode:
authorDavid Luevano Alvarado <david@luevano.xyz>2023-05-05 03:16:06 -0600
committerDavid Luevano Alvarado <david@luevano.xyz>2023-05-05 03:16:06 -0600
commit70e783628b1bf863da45cc8879b06288a498840b (patch)
tree6a61d3134fbb100f0fc04e9e96782d29e24bb5ed /src/blog/a/git_server_with_cgit.md
parentec2aa74d36670d74c153aa0022ab22e79502a061 (diff)
update css, make articles more uniform, add toc and add functionality to scroll to the top
Diffstat (limited to 'src/blog/a/git_server_with_cgit.md')
-rw-r--r--src/blog/a/git_server_with_cgit.md24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/blog/a/git_server_with_cgit.md b/src/blog/a/git_server_with_cgit.md
index 4eb440c..63fae28 100644
--- a/src/blog/a/git_server_with_cgit.md
+++ b/src/blog/a/git_server_with_cgit.md
@@ -4,21 +4,26 @@ lang: en
summary: How to create a git server using cgit on a server running Nginx. This is a follow up on post about creating a website with Nginx and Certbot.
tags: server
tools
+ code
tutorial
english
-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](https://git-scm.com/book/en/v2/Git-on-the-Server-Setting-Up-the-Server) plus some specific stuff for (btw i use) Arch Linux ([Arch Linux Wiki: Git server](https://wiki.archlinux.org/index.php/Git_server#Web_interfaces) and [Step by step guide on setting up git server in arch linux (pushable)](https://miracoin.wordpress.com/2014/11/25/step-by-step-guide-on-setting-up-git-server-in-arch-linux-pushable/)).
+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](https://git-scm.com/book/en/v2/Git-on-the-Server-Setting-Up-the-Server) plus some specific stuff for ==btw i use== Arch Linux ([Arch Linux Wiki: Git server](https://wiki.archlinux.org/index.php/Git_server#Web_interfaces) and [Step by step guide on setting up git server in arch linux (pushable)](https://miracoin.wordpress.com/2014/11/25/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.
+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.
-## Prerequisites
+# Table of contents
+
+[TOC]
+
+# 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](https://blog.luevano.xyz/a/website_with_nginx.html) and [mail](https://blog.luevano.xyz/a/mail_server_with_postfix.html) entries), with the extras:
- (Optional, if you want a "front-end") A **CNAME** for "git" and (optionally) "www.git", or some other name for your sub-domains.
- An SSL certificate, if you're following the other entries, add a `git.conf` and run `certbot --nginx` to extend the certificate.
-## Git
+# Git
[Git](https://wiki.archlinux.org/title/git) is a version control system.
@@ -76,14 +81,14 @@ You're basically done. Now you should be able to push/pull repositories to your
```sh
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](https://gist.github.com/rvl/c3f156e117e22a25f242).
-## Cgit
+# Cgit
[Cgit](https://wiki.archlinux.org/title/Cgit) is a fast web interface for git.
@@ -139,11 +144,10 @@ 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*](https://git.luevano.xyz/.dots) 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*](https://git.luevano.xyz/.dots) I have:
```apache
...
@@ -156,6 +160,8 @@ 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)](https://man.archlinux.org/man/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:
```sh