Move Gitea to another server

Hello!
I will have to move my Gitea installation to another server.
Has anyone already done this? Maybe someone can give me some advices.

Thanks
Tim

I did it once it’s super easy!! All you need to do is backup your database, I suppose you’re using MySQL/MariaDB.

# mysqldump -u root -p gitea_database > gitea_database.sql

Now backup your repositories, these are located under /home/git/gitea-repositories. I’m assuming you installed Gitea as their site reads if so you’re good to go.

On the new server install Gitea the same way you did it before and once you have it up and running stop the Gitea service then restore your database backup

# mysql -u root -p gitea_database < /path/to/your/sql/file

When the task finish restore your repositories backup and start Gitea service.

Maybe this is not the real procedure to migrate gitea to a new server, but it worked for me.

Regards

Hi @trnc

Thank you very much. I will try this. :slight_smile:

Tim

It’s also important to run the following tasks from the admin panel:

  • Update the ‘.ssh/authorized_keys’ file with Gitea SSH keys. (Not needed for the built-in SSH server.)
  • Resynchronize pre-receive, update and post-receive hooks of all repositories.

So I finally took some time to migrate my instance to a better server. I backed up every relevant folder mentioned in app.ini and the gitea source folder itself (my server is running usually the latest master from Github) and migrated that to my better server. There I updated the paths in app.ini to adjust it for my new folder structure. Then I did the PostgreSQL equivalent of backing up my gitea DB, as @trnc explained. Then I imported the database, after installing PostgreSQL. That was it. Nothing special about it. I plan to write an article about it, to make it super easy for future generations who like to directly compile the software themselves.

4 Likes