Automated backups on Windows

Hello Gitea Community,

What is the best way to run automated backups on Windows?

At the moment I have a batch file, this will be started by a scheduled task. The zip file is getting created. But now I’m unable to copy this zip file, because I don’t know the name of the file. Is there a way to set a name or a path for the zip file?

Thanks a lot!

Kind regards

Another problem is, when gitea runs, it is not possible to create a backup. So, I need a solution to shut the service temporally down.

What is a proper way to solve this problems? I am interested in your solutions, please let me know them!

I am working on a local backup script that I think will include the dump,then moving all files starting with “gitea-dump-” to a “backup”-folder (gitea dump; mv gitea-dump-* backup/; cp backup/ ...) or something like that, and then I will be able to directly copy the backup folder. Then again, I am working with docker containers, so that is why I can’t copy using a wildcard.

When you are running Gitea, if you start it from a terminal, have you tried running gitea dump in parallel? I just tried it locally and as far as I can see it created a proper backup, but I am not aware of your setup.

Thanks a lot for your reply!

When you are running Gitea, if you start it from a terminal, have you tried running gitea dump in parallel? [/quote]

Yes, I tried that, but something is in use and I got this error message:

Failed to save read C:/Users/UserName/gitea/data/indexers/issues.bleve/store.lock: The process cannot access the file because another process has locked a portion of the file.

Weird, are you doing this with an elevated terminal, as an administrator?

What do you mean with “elevated terminal”? I did it with the windows console (cmd.exe) as admin.

Now I run gitea as a Windows service and the problem still exists.

It would be very nice to run automated backups. In my opinion it is an important point, because I will forget to run backups.

Are there any ideas out there?

Kind regards

That is what I was going for, and I just tested it out locally to see and it works for me.

I did a quick search on your error message and found this
Perhaps it is something that could apply to you?

I think that is not the problem. Because when I shutdown the gitea webservice the backup runs. I think gitea has a file in use and look this file. I the evening I will try this on another machine, to find out the behavior.

Different machine, different OS (Win10/Win7) , equal repositories, equal error message.

Gitea version 1.7.5

Can any body reconstruct this error?

Here we are,

I figured out a solution. When gitea runs as windows service, the following batch file does backup and move the zip file.


cd c:\windows\system32

sc stop gitea

cd c:\Users\UserName\gitea\

gitea dump

cd c:\windows\system32

sc start gitea

cd c:\Users\UserName\gitea\

move c:\Users\UserName\gitea\*.zip x:\Backups\gitea

I run this file by a scheduled task. The task has to run with highest privileges!

Thanks a lot for your interest and help! :blush:

Kind regards


Great, good to see you figured it out! My pleasure, though I wish I could have been of more help I think. :wink:

How did you configured this task?
I tried to use your script, but it doesn’t work for me. Task returns code 2147942401.

Maybe that will help you: