After looking around I couldn't find any place that had step by step instructions to do this. This will show you how to convert any migrated Gitea repo to a mirror repo. Only tested with gitHub repositories.
My use case: I migrated a GitHub repo and all of its issues/releases/etc with the API key option. When you create a fully cloned migration Gitea doesn't let you make it a mirror AFAIK. So you have to go digging through the Gitea database in order to change it to a mirror. And it does in fact work, you can migrate a remote repo in its entirety and thenchange it to mirror. Note: When you change to mirror, it will not mirror anything that requires an API key, it will just mirror the git repo.
Open the Gitea database:
- On default installations
sqlite3 /opt/mailcow-dockerized/data/gitea/gitea/gitea.db - Or custom installation
sqlite3 gitea.dbin the gitea data directory wherever you installed it
# Look for the repo you want to convert and ensure the last number is not 1
SELECT id,name,is_mirror from repository;
# Replace REPO_ID with the ID from above
UPDATE repository SET is_mirror='1' WHERE id=REPO_ID;
# This will look for the next available ID for us to add into the mirror table
SELECT id FROM mirror ORDER BY id DESC LIMIT 1;
# Get the number you got from above and add 1 to it (num + 1) and replace NEW_MIRROR_ID with it. Replace REPO_ID with the repo ID from the first step
INSERT INTO mirror VALUES(NEW_MIRROR_ID, REPO_ID, 28800000000000, 1, 0, 0);No instructions since I do not run those but I assume they are fairly similar, just some minor conversions to the syntax the database software uses.
- Make backups :pepega:
- Modify the queries to whatever database used