Upgrading from 1.15 to latest version possible

I am running Gitea 1.15 on Ubuntu directly with the binary. I made a back up of my database and my data folder before downloading the latest binary (1.25.5). After stopping Gitea, I renamed the 1.15 binary, moved the 1.25.5 binary in place with the old name and tried starting Gitea. It failed to start and one of the issues was outdated template tags. The template I think was /var/lib/gitea/custom/templates/home.tmpl but I did not create that file (I assume it was created by the original installation of 1.15); What is the recommend method to make sure everything in /var/lib/gitea/ updates for the new version without causing data loss for the repos?

Edit: I restored my database and data folder and reverted to running 1.15 for now.

1 Like

Welcome to the Gitea forum.

Have you considered incrementally upgrading across the highest point versions of each subsequent release instead of trying to fast forward directly to current?

I considered that, that was one reason I wanted to ask on the forum to see what other’s experiences were! I’ll give that a try and will report back.

You hit this because of old custom templates, not your repos.

Fix (short):

  1. Remove/disable custom overrides:
mv /var/lib/gitea/custom /var/lib/gitea/custom_backup
  1. Don’t jump versions — upgrade step-by-step:
1.15 → 1.17 → 1.19 → 1.21 → 1.25
  1. Start Gitea at each step and let it migrate.

:backhand_index_pointing_right: Your repo data in /var/lib/gitea is safe — just don’t delete it.

Ah, this is exactly the advice for which I was looking! You say don’t jump versions, but there are some gaps in what you listed, I assume this is the recommended version path?

This worked perfectly, summarizing the process I used:

# Download each needed binary to ~/gitea/
cd ~/gitea/
wget https://dl.gitea.com/gitea/1.17.4/gitea-1.17.4-linux-amd64
wget https://dl.gitea.com/gitea/1.19.4/gitea-1.19.4-linux-amd64
wget https://dl.gitea.com/gitea/1.21.11/gitea-1.21.11-linux-amd64
wget https://dl.gitea.com/gitea/1.25.5/gitea-1.25.5-linux-amd64
chmod +x gitea*

# UPGRADE LOOP: For each version, make backup into ~/gitea/backups/ and copy new binary to /usr/local/bin/gitea and launch from command line to verify migration success
sudo rm ~/gitea/backups/*
mysqldump --routines -p gitea > ~/gitea/backups/gitea.sql
sudo tar -cvpzf ~/gitea/backups/var-lib-gitea.tar /var/lib/gitea
sudo systemctl stop gitea.service
# Replace gitea version, REPLACE EACH TIME WITH THE NEXT VERSION NUMBER
sudo cp ~/gitea/gitea-1.17.4-linux-amd64 /usr/local/bin/gitea
# Test running as the git user
sudo su - git
cd /etc/gitea/
/usr/local/bin/gitea web -c /etc/gitea/app.ini --work-path=/var/lib/gitea/

Thanks for the help!

1 Like

Glad to hear that it worked out!