Move repository

I want to move my repo from

[repository]
ROOT = /home/git/gitea-repositories

to a mount point like
ROOT = /var/lib/gitea

What do I have to do? Stop the service, change app.ini and start the service?

THX

You need to modify environment variable in service file systemd/gitea.service
WorkingDirectory and GITEA_WORK_DIR

systemctl daemon-reload
systemctl restart gitea

systemctl status gitea

you can check yous configuration with
sudo -H -u git bash -c ‘/usr/local/bin/gitea --config /etc/gitea/app.ini doctor check’

1 Like

I’m running gitea in a proxmox LXC:

root@GitLab .../systemd/system# systemctl status gitea
* gitea.service - Gitea (Git with a cup of tea)
     Loaded: loaded (/etc/systemd/system/gitea.service; enabled; vendor preset: enabled)
     Active: active (running) since Tue 2024-02-13 14:15:19 UTC; 4 weeks 1 days ago
   Main PID: 1102 (gitea)
      Tasks: 10 (limit: 9308)
     Memory: 96.7M
        CPU: 18min 46.909s
     CGroup: /system.slice/gitea.service
             `-1102 /home/git/gitea web -c /etc/gitea/app.ini

There is no GITEA_WORK_DIR environment-variable…

Good morning,
poor understanding of the expected, I thought you wanted to modify the work path
app.ini gitea/custom/conf/app.example.ini at main · go-gitea/gitea · GitHub

;; The working directory, see the comment of AppWorkPath above
;WORK_PATH =

and in this case then you should have modified the variables in the file /etc/systemd/system/gitea.service

I would like to be sure I understand,
If we follow the Gitea documentation (Installation from binary | Gitea Documentation),
mkdir -p /var/lib/gitea/{custom,data,log}

you should have something that looks like this

/var/lib/gitea/data/gitea-repositories
/var/lib/gitea/data/packages
/var/lib/gitea/data/repo-archive

If you want to move gitea-repositories to another location
then you are right,

;[repository]
;; Root path for storing all repository data. By default, it is set to %(APP_DATA_PATH)s/gitea-repositories.
;; A relative path is interpreted as _`AppWorkPath`_/%(ROOT)s
;ROOT =
1 Like

THX and sorry for asking again: Changing the path forces a move of existing repositories? Or do I have to move them manually?

Gitea itself does not move any data. As soon as you have changed the repo path, Gitea no longer recognizes the old path. You must therefore move the data yourself. From the workflow: 1. stop Gitea. 2. move the data. 3. change the path in the configuration. 4. start Gitea.

1 Like

Thanks a lot! Now it was an easy job!
There is no UI where I can see which repository root is used?

Exactly the censored lines show you what Gitea knows:

1 Like