mirror of
https://github.com/RayLabsHQ/gitea-mirror.git
synced 2026-04-25 07:15:57 +03:00
[GH-ISSUE #20] Error: [ERROR] SQLiteError: attempt to write a readonly database #7
Labels
No labels
bug
documentation
enhancement
help wanted
pull-request
question
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/gitea-mirror#7
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @kylepyke on GitHub (May 27, 2025).
Original GitHub issue: https://github.com/RayLabsHQ/gitea-mirror/issues/20
I can't seem to get past this permissions error to open/write to the database, and there isn't much in the docs describing necessary database permissions.
@kylepyke commented on GitHub (May 28, 2025):
I had to
chmod 777the database folder AND the folder where the database resides to get past this error. Any advice on what the permissions need to be here?@arunavo4 commented on GitHub (May 28, 2025):
Hi @kylepyke,
Thanks for reporting this issue! You're absolutely right about the permission requirements, and I appreciate you sharing the solution that worked for you.
The Issue
This SQLite permission error occurs when running Gitea Mirror directly on your system (not in Docker). SQLite requires:
data/gitea-mirror.db)data/folder) - this is needed for SQLite's temporary files, WAL files, and journal filesRecommended Solutions
Option 1: Use Docker (Recommended)
The easiest way to avoid this issue entirely is to use Docker, which handles all permissions automatically:
Why Docker doesn't have this issue:
gitea-mirroruser that owns the/app/datadirectoryOption 2: Fix Permissions for Direct Installation
If you prefer to run the application directly, here's the proper way to set permissions (more secure than
chmod 777):Why
chmod 777Worked (But Isn't Recommended)Your
chmod 777solution worked because it gave read/write/execute permissions to everyone (owner, group, and others). While this fixes the immediate issue, it's not recommended for security reasons as it makes the database accessible to all users on the system.Documentation Update
I've added a section to the README specifically addressing this issue for users who choose to run the application directly instead of using Docker. You can find it in the "Database Permissions for Direct Installation" section.
Recommendation
For production use, I strongly recommend using Docker or Docker Compose as it provides:
Let me know if you have any other questions or if the suggested solutions work for you!
@kylepyke commented on GitHub (May 28, 2025):
I am using docker and still receiving this error. I deployed gitea-mirror using docker compose via Portainer.
EDIT: Aha, I think I see the issue:
I'm passing a bind mount in the docker compose, which is not used by the
gitea-mirroruser.@arunavo4 commented on GitHub (May 28, 2025):
@kylepyke So you can either
sudo chown -R 1001:1001 /host/path/to/dataAdded a section to readme for people having this issue in the future
@kylepyke commented on GitHub (May 28, 2025):
Thank you, and really appreciate your work on this project!!
Will I be able to switch to named volumes, and keep my current database with all of my synced repositories? I assume no...
@arunavo4 commented on GitHub (May 28, 2025):
@kylepyke take a backup by simply accessing the file and then replace it after you have made a new deployment with named volume