HOWTO restore a Gitea backup with PostgresSQL

Unstructured but somewhat sequential command reminders.


  • cd /tmp/a
  • unzip gitea-dump.zip
  • docker run -v $(pwd)/a:/tmp/a -p 3000:3000 -p 2222:22 --name hostea1 -ti debian:bullseye bash
  • apt-get update && apt-get install postgresql-13 git wget procps net-tools vim
  • pg_ctlcluster 13 main start
  • su - postgres # using values found in the [database] section of app.ini
    • CREATE ROLE gitea LOGIN PASSWORD '******';
    • CREATE DATABASE gitea;
    • GRANT CONNECT ON DATABASE gitea TO gitea;
  • psql -h 127.0.0.1 -U gitea -d gitea < gitea-db.sql
  • useradd git # using the RUN_USER value of app.ini
  • mkdir /var/log/gitea ; chown git /var/log/gitea # using the [log] ROOT_PATH value of app.ini
  • mkdir -p /var/lib/gitea/data/lfs ; chown git /var/lib/gitea/data/lfs # using the [server] LFS_CONTENT_PATH value of app.ini
  • su - git
  • unzip gitea-repo.zip # in parent directory of [repository] ROOT of app.ini
  • modify [server] DOMAIN to localhost in app.ini
  • modify [server] ROOT_URL to http://localhost:3000 in app.ini
  • wget -O gitea https://github.com/go-gitea/gitea/releases/download/v1.16.8/gitea-1.16.8-linux-amd64
  • ./gitea -c /tmp/a/app.ini migrate
  • ./gitea -c /tmp/a/app.ini doctor --all
  • ./gitea -c /tmp/a/app.ini admin user create --admin --username loic --password loic --email loic@example.com
  • ./gitea -c /tmp/a/app.ini web
  • firefox http://localhost:3000 or whatever the [server] HTTP_PORT is in app.ini
1 Like