is it possible to migrate/move repositories from Gitea to Forgejo?
Yes — you can migrate repositories from Gitea to Forgejo. Options:
- Quick full repo transfer via Git (recommended for single or many repos)
On source (or any machine with network access):
Clone mirror:
git clone --mirror https://gitea.example.com/user/repo.gitCreate an empty repo on Forgejo (same name or new).
Push mirror to Forgejo:
cd repo.gitgit remote add forgejo https://forgejo.example.com/user/repo.gitgit push --mirror forgejoThis preserves all branches, tags, and refs. Update CI/webhooks manually.
- Using bare repo + rsync (for large repos or server-to-server)
Create bare repo on source:
git clone --bare /path/to/repo /tmp/repo.gitrsync -a /tmp/repo.git user@forgejo-server:/var/forgejo/git/repositories/user/repo.gitSet proper permissions, then run repo maintenance on Forgejo.
- Using API or web UI import (if available)
- Some Forgejo instances may offer an “Import repository” UI where you supply the Gitea repo URL and credentials; this runs a server-side clone and creates the repo.
- Preserve issues, pull requests, wikis, and metadata
Git transfer only moves Git data. For issues/PRs/wiki/comments:
- Export from Gitea via its API (issues, PRs, attachments) or use Gitea’s dump/backup tools.
- Import into Forgejo via its API or use community scripts/tools (third‑party migration scripts exist but verify compatibility).
- Alternatively, convert issues to Markdown files and push to the new repo if full import isn’t required.
- Permissions, hooks, and CI
- Recreate access controls, teams/groups, webhooks, and CI pipelines on Forgejo after import.
Checklist summary:
- Mirror-push Git data with git clone –mirror + git push –mirror.
- Create repos on Forgejo first (or use import URL).
- Export/import issues/PRs/wiki via APIs or scripts if needed.
- Reconfigure permissions, webhooks, CI, and integrations.
If you want, tell me how many repos and whether you need issues/PRs migrated and I’ll give a specific script/command sequence.
Ok. We only have 4 very small reops at the moment. Could we just copy the repos from the Gitea directory to the same dir for forgejo and copy the sqlite3 database as well?
You can, but it’s risky and not recommended unless you fully control both servers and understand service versions and internals. Short guidance and safer alternatives:
Risks of directly copying repos + DB
- Schema or version differences between Gitea and Forgejo can make the SQLite DB incompatible (corrupt data, crashes).
- UUIDs/IDs, path formats, or internal metadata may differ causing mismatched repo entries.
- File permissions, hooks, and repo ownership may be wrong.
- Attachments, LFS data, and custom settings may be missed.
- Downtime required; you must stop both services to avoid writes during copy.
If you still want to try (make backups first)
Stop both services (prevent writes):
- systemctl stop gitea
- systemctl stop forgejo
Backup everything (mandatory):
- Copy the entire Gitea repos dir and DB to a safe location:
- cp -a /path/to/gitea-repositories /backup/gitea-repositories
- cp /path/to/gitea/data/gitea.db /backup/gitea.db
- Also backup configs and custom files.
- Copy the entire Gitea repos dir and DB to a safe location:
Copy repos:
- cp -a /path/to/gitea-repositories/* /path/to/forgejo-repositories/
- Ensure repository directory naming and structure match Forgejo expectations.
Copy SQLite DB (if you choose):
- cp /path/to/gitea/data/gitea.db /path/to/forgejo/data/forgejo.db
- Ensure file ownership (run as forgejo user) and permissions:
- chown -R forgejo:forgejo /path/to/forgejo-repositories /path/to/forgejo/data/forgejo.db
- chmod as appropriate.
Start Forgejo and check logs:
- systemctl start forgejo
- tail -f /var/log/forgejo/*.log (or service journal) and resolve errors.
Safer recommended alternatives (pick one)
- Mirror push each repo (no DB fiddling):
- git clone –mirror https://gitea.example.com/user/repo.git
- Create empty repo on Forgejo
- git push –mirror https://forgejo.example.com/user/repo.git
- This avoids DB compatibility issues and is simple for 4 small repos.
- Use Forgejo import UI/API to pull from Gitea URLs.
- Export issues/PRs via Gitea API and import via Forgejo API if you need metadata.
Recommendation: For only 4 small repos, use git clone –mirror + git push –mirror (fast, safe). If you still want to copy filesystem + DB, test on a throwaway instance first and keep full backups.
Ok. Can we have a step by step descrition of the recommeded : git clone –mirror + git push –mirror aproach?
Prerequisites
- A machine with git installed and network access to both Gitea and Forgejo (can be your local machine or one of the servers).
- You can create empty repositories on Forgejo (web UI or API) or have admin access to create them.
- Credentials or SSH keys for both servers.
Step-by-step (recommended)
- Create an empty repo on Forgejo
- Using the Forgejo web UI or API, create a new repository named exactly as you want (e.g., repo.git). Do not initialize with README or .git — it must be empty.
- On your machine, create a working directory and enter it
mkdir ~/repo-mirror && cd ~/repo-mirror- Mirror-clone the repo from Gitea
- HTTPS:
git clone --mirror https://gitea.example.com/user/repo.git- Or SSH:
git clone --mirror git@gitea.example.com:user/repo.gitThis creates a bare mirror repo directory named repo.git containing all refs, branches, and tags.
- Add Forgejo as a remote and push mirror
- Change into the mirror directory:
cd repo.git- Add Forgejo remote (replace URL):
git remote add forgejo https://forgejo.example.com/user/repo.gitor for SSH:
git remote add forgejo git@forgejo.example.com:user/repo.git- Push all refs, branches, tags, and refs exactly:
git push --mirror forgejo- Verify on Forgejo
- Check the Forgejo repo UI for branches, tags, commits.
- Optionally clone the new repo to confirm:
cd ~/repo-mirrorgit clone https://forgejo.example.com/user/repo.git test-clonecd test-clonegit branch -agit tag- Repeat for each repository
- Repeat steps 2–5 for each of the 4 repos. You can script it for convenience.
- Migrate issues, PRs, wikis, attachments (optional)
Git-only migration does not move issues/PRs/wiki/comments.
Export from Gitea via API or use backup tools and import into Forgejo using its API or community scripts.
- Clean up
- Remove temporary mirror directories if desired:
rm -rf ~/repo-mirrorNotes/tips
- Use –mirror to preserve all refs and refs/meta (exact mirror).
- If you prefer to keep history but not necessarily exact refs, use
git clone --barethengit push --allandgit push --tags. - For many repos, script with a list of repo URLs to automate cloning and pushing.
- If using HTTPS and two-factor auth, create and use a personal access token as password.