Skip to content

Gitea

Gitea is used to have local git repos. I typically use it as a backup (mirror) of my GitHub repos.

🛠 Installation

Default Port: 3000

Configuration path: /etc/gitea/

Custom path: /var/lib/gitea/custom/

bash -c "$(wget -qLO - https://github.com/community-scripts/ProxmoxVE/raw/main/ct/gitea.sh)"
bash -c "$(wget -qLO - https://github.com/asylumexp/Proxmox/raw/main/ct/gitea.sh)"

âš™ Config

catppuuccin Catppuccin

Info

Gitea 1.20 or newer is required for this theme.

  1. Download the latest GitHub release.
  2. Place the CSS files inside Gitea's configuration directory:
  3. Gitea 1.21.0 or newer: $GITEA_CUSTOM/public/assets/css
  4. Otherwise: $GITEA_CUSTOM/public/css
  5. Add the themes to your app.ini. For further information on customizing Gitea, see the Gitea documentation.
  6. Restart your Gitea instance.
  7. Select the theme in Gitea > Account > Settings > Appearance.

🎨 Flavor-Accent

/etc/gitea/app.ini

[ui]
THEMES = catppuccin-latte-rosewater,catppuccin-latte-flamingo,catppuccin-latte-pink,catppuccin-latte-mauve,catppuccin-latte-red,catppuccin-latte-maroon,catppuccin-latte-peach,catppuccin-latte-yellow,catppuccin-latte-green,catppuccin-latte-teal,catppuccin-latte-sky,catppuccin-latte-sapphire,catppuccin-latte-blue,catppuccin-latte-lavender,catppuccin-frappe-rosewater,catppuccin-frappe-flamingo,catppuccin-frappe-pink,catppuccin-frappe-mauve,catppuccin-frappe-red,catppuccin-frappe-maroon,catppuccin-frappe-peach,catppuccin-frappe-yellow,catppuccin-frappe-green,catppuccin-frappe-teal,catppuccin-frappe-sky,catppuccin-frappe-sapphire,catppuccin-frappe-blue,catppuccin-frappe-lavender,catppuccin-macchiato-rosewater,catppuccin-macchiato-flamingo,catppuccin-macchiato-pink,catppuccin-macchiato-mauve,catppuccin-macchiato-red,catppuccin-macchiato-maroon,catppuccin-macchiato-peach,catppuccin-macchiato-yellow,catppuccin-macchiato-green,catppuccin-macchiato-teal,catppuccin-macchiato-sky,catppuccin-macchiato-sapphire,catppuccin-macchiato-blue,catppuccin-macchiato-lavender,catppuccin-mocha-rosewater,catppuccin-mocha-flamingo,catppuccin-mocha-pink,catppuccin-mocha-mauve,catppuccin-mocha-red,catppuccin-mocha-maroon,catppuccin-mocha-peach,catppuccin-mocha-yellow,catppuccin-mocha-green,catppuccin-mocha-teal,catppuccin-mocha-sky,catppuccin-mocha-sapphire,catppuccin-mocha-blue,catppuccin-mocha-lavender

🤖 Auto

This ensures that the theme automatically switches between light (latte) and dark (mocha) mode.

/etc/gitea/app.ini

[ui]
THEMES = catppuccin-rosewater-auto,catppuccin-flamingo-auto,catppuccin-pink-auto,catppuccin-mauve-auto,catppuccin-red-auto,catppuccin-maroon-auto,catppuccin-peach-auto,catppuccin-yellow-auto,catppuccin-green-auto,catppuccin-teal-auto,catppuccin-sky-auto,catppuccin-sapphire-auto,catppuccin-blue-auto,catppuccin-lavender-auto

Code

(
  [ -d /var/lib/gitea/custom/public/assets/css ] || mkdir -p /var/lib/gitea/custom/public/assets/css
  wget https://github.com/catppuccin/gitea/releases/latest/download/catppuccin-gitea.tar.gz -O /tmp/catppuccin-gitea.tar.gz && \
  tar -xvf /tmp/catppuccin-gitea.tar.gz -C /var/lib/gitea/custom/public/assets/css && \
  systemctl restart gitea.service
)

🔔 Email Notifications

Enable email notifications using mailrise.

/etc/gitea/app.ini

[mailer]
ENABLED        = true
FROM           = [email protected]
PROTOCOL       = smtp
SMTP_ADDR      = smtp.l.nicholaswilde.io
SMTP_PORT      = 8025

📧 Send a test email

  1. Open your Git server (Gitea, GitHub, GitLab, etc.) in a web browser.

  2. Go to your "Site Administration".

  3. Find the "Configuration -> Summary" (or similar) section.

  4. Under "Mailer Configuration", enter [email protected] and click the "Send" button.

SSH Domain

To be able to pull the gitea repo using a domain name rather than an IP address, change the following:

/etc/gitea/app.ini

[server]
SSH_DOMAIN = gitea-ssh.l.nicholaswilde.io
DOMAIN = gitea.l.nicholaswilde.io
HTTP_PORT = 3000
ROOT_URL = https://gitea.l.nicholaswilde.io/
APP_DATA_PATH = /var/lib/gitea/data
DISABLE_SSH = false
SSH_PORT = 22

The gitea repo should now show the SSH_DOMAIN in the Code button under SSH in the web GUI.

[email protected]:nicholas/homelab.git

AdGuardHome DNS Rewrite

In AdGuardHome DNS Rewrites, add an entry that forwards the SSH_DOMAIN directly to your gitea LXC.

  • Domain: gitea-ssh.l.nicholaswilde.io
  • Answer: 192.168.2.20

🔑 Add Your Remote Machine's Public Key to Your Git Server

Your remote machine needs to be "authorized" to access your Git server. You do this by giving the server your machine's public key.

  1. Display the public key on your remote machine and copy it to your clipboard.

Remote LXC

cat ~/.ssh/id_rsa.pub
# Or, if you made an ed25519 key:
cat ~/.ssh/id_ed25519.pub

The output will look something like ssh-ed25519 AAAAC3... [email protected].

  1. Open your Git server (Gitea, GitHub, GitLab, etc.) in a web browser.

  2. Go to your user Settings.

  3. Find the "SSH / GPG Keys" (or similar) section.

  4. Click "Add Key" and paste the public key you just copied.

Usage

You can then clone a repo using the hostname rather than the gitea IP address.

remote machine

git clone [email protected]:nicholas/homelab.git

Traefik

homelab/pve/traefik/conf.d/gitea.yaml
---
http:
 #region routers 
  routers:
    gitea:
      entryPoints:
        - "websecure"
      rule: "Host(`gitea.l.nicholaswilde.io`)"
      middlewares:
        - default-headers@file
        - https-redirectscheme@file
      tls: {}
      service: gitea

#endregion
#region services
  services:
    gitea:
      loadBalancer:
        servers:
          - url: "http://192.168.2.20:3000"
        passHostHeader: true
#endregion

Task List

task: Available tasks for this project:
* decrypt:       Decrypt .env using SOPS
* encrypt:       Encrypt .env using SOPS
* export:        Export the task list
* init:          Init
* mklinks:       Make client symlinks
* restart:       Restart service
* status:        Status
* stop:          Stop service
* update:        Update running containers
* upgrade:       Upgrade app

🔗 References