A simple script to migrate your Github repos to Gitea
This is a simple script to help you migrate your Github repositories to Gitea.
It was designed only for my personal use and it has a some limitations that might make it not useful for your needs:
IGNORE_REPO
env variable can be useful here to no try to migrate the same repo againThe script needs tokens to access the Github and Gitea APIs, as well as the endpoint to a Gitea installation. It reads this information from environment variables, which can be set with an .env
file, put in the same folder as the script. Check the .env.example
file for all the available variables.
After setting up the environment variables, you can just run the script with php migrate.php
.
Important: Don’t forget to install the dependencies by running composer install
As said in the Overview section, this script does not handle errors. If it fails during the middle of a migration, you’ll need to run it again meaning it might end up trying to migrate repositories that have been migrated already. Gitea will complain about that and the script will fail. To avoid that, the IGNORE_REPO
environment variable can be used to tell the script which repos it should not try to migrate again. The variable should be a comma separated list (no spaces) of repository names.