Gitea - Restoring Gitea

Posted on February 9, 2020

Create a Backup

To create a backup of the gitea instance, run the following command:

This will produce a zip file usually in the form gitea-dump-<some-numbers>.zip. I then store this to my external hard drive or in my google drive. If you want to version this in git, you need to have git lfs enabled because this can be a huge file.

Restore the Backup

This is the documentation on how to restore from the backup. I installed my instance this way but even after substituting all the right directories it didn’t work.

So here’s what I did. First thing I did was I initialized gitea like a new install. Setting up the database, domain, admin user, etc. Once that’s done I basically copy-pasted my backup to where my freshly installed gitea resides in my digital ocean droplet.

The Backup File

I unzip the zip file

then copy app.ini to /opt/gitea/custom/conf/app.ini. I didn’t do the sqlite3 restore because it was just giving me a bunch of errors. So what I did is copy the entire data/ directory from my backup and pasted it in /opt/gitea/. This will overwrite the data/ directory that was generated by the installation.

I unzip the repositories

then move that to /opt/gitea/

Setting up SSH

I had to go to the gitea admin web UI in the dashboard tab, and had to run Update the ‘.ssh/authorized_keys’ file with Gitea SSH keys. (Not needed for the built-in SSH server.)

This generated .ssh/authorized_keys with the approriate commands. After this file was generated then I pasted my public ssh key in it.

I was then able to clone using the ssh link.

Source

https://docs.gitea.io/en-us/backup-and-restore/#backup-and-restore