You Don't Need Forgejo
People @@ -69,7 +36,7 @@
I'll be using Caddy as the webserver for this setup, but I'll link tutorials for NGINX and Apache if prefer xml configuration files and manual https certificates ;)
To keep everything organized, I'll run cgit under a user called "git". Our git repos will be stored in this directory.
-$ useradd -r -d /var/lib/cgit -s /usr/bin/git-shell git
$ useradd -r -d /var/lib/cgit -s /usr/bin/git-shell git
fcgiwrap
cgit is served as a cgi application.
@@ -88,7 +55,7 @@Install cgit with a package manager. This will place the cgit files at /var/www/htdocs/cgit
Make sure that location is owned by "git", but is readable by all users:
-$ chown -R git /var/www/htdocs/cgit && chmod -R 764 /var/www/htdocs/cgit
$ chown -R git /var/www/htdocs/cgit && chmod -R 764 /var/www/htdocs/cgit
Lock down SSH access
-Using git-shell
- blocks normal shell access and allows only git-style SSH commands.
Using git-shell blocks normal shell access and allows only git-style SSH commands.
-
-
Create an SSH directory for the
git- user:$ install -d -o git -g git -m 700 /var/lib/cgit/.ssh
+ Create an SSH directory for the git user:
$ install -d -o git -g git -m 700 /var/lib/cgit/.sshAdd your public key to
/var/lib/cgit/.ssh/authorized_keyswith mode600.
Create some repos
Create a bare repository:
-$ sudo -u git git init --bare /var/lib/cgit/example
$ sudo -u git git init --bare /var/lib/cgit/example
Push to it from your local machine:
$ git remote add origin git@git.my.tld:example
$ git push -u origin main
cgitrc
-A clean default /etc/cgitrc file might look like this:
+A clean default /etc/cgitrc file might look like this:
css=/cgit.css
logo=
virtual-root=/
--
cgit v1.3.1