Updating gitea is a simple as replacing the binary in /usr/local/bin/gitea.

  1. Stop the gitea service

    $ sudo systemctl stop gitea

  2. Move the current binary from gitea to gitea.old just in case things break.

    $ sudo mv /usr/local/bin/gitea /usr/local/bin/gitea.old

  3. Use wget to get the the current version: example -> https://github.com/go-gitea/gitea/releases/download/v1.20.2/gitea-1.20.2-linux-amd64. This is not the latest version, this is just an example.

    cd ~/Downloads && wget https://github.com/go-gitea/gitea/releases/download/v1.20.2/gitea-1.20.2-linux-amd64

  4. Change the name of the file from gitean-x.x.x-linux-amd to gitea

    $ mv gitea-x.x.x-linux-amd gitea

  5. Make a backup of /var/lib/gitea/ as well as the gitea database. Change to your username.

    $ mkdir ~/temp && cd ~/temp && tar czvf gitea-old.tgz /var/lib/gitea

$ mysqldump --user=wretchedghost --password --lock-tables --databases gitea > gitea-20231208.sql

  1. Copy the new gitea binary to /usr/local/bin/

    $ sudo cp ~/Downloads/gitea /usr/local/bin/

  2. Change owner and mode of the gitea binary

    $ sudo chown root:root /usr/local/bin/gitea

$ sudo chmod 755 /usr/local/bin/gitea

  1. Start gitea

    $ sudo systemctl start gitea

  2. Make sure things work then you may safely delete the /usr/local/bin/gitea.old

    $ sudo rm -rf /usr/local/bin/gitea.old