5 Steps: Migrate from GitLab to Gitea: Freedom from Restrictions and Limitations

5 Steps: Migrate from GitLab to Gitea: Freedom from Restrictions and Limitations
Photo by Pankaj Patel / Unsplash

In the world of software development, finding the right tools and platforms is crucial. However, recent restrictions and limitations imposed by GitLab have left many users searching for alternatives. This article explores why migrating from GitLab to Gitea, a lightweight and open-source Git service, can provide freedom from these constraints. Let's discover how Gitea offers a fresh approach to Git hosting, empowering developers with more flexibility and control.

After fiddling around with a few migration tools i finally found one that suit my needs the best. And the best part: It's docker ready.

Initial setup steps:

  1. Create a new "Personal Access Token" in Gitlab (you have to use an admin account for this)
    Select all scopes and save the generated token

  2. Create a new "Application / Access Token" in your Gitea instance.
    -> User (top right) -> Settings -> Applications
    Select all scopes as well and save the generated token

  3. Clone this repository somewhere you got docker installed

  4. Add a .env file to the repository with the following content:
    Replace with your generated tokens and optional an admin user if your repositories are private (not publicly accessible).

    For migrating from a self-hosted gitlab instance, use MIGRATE_BY_GROUPS=0
    For migrating from the global gitlab.com, use MIGRATE_BY_GROUPS=1 which migrates only projects and users which belong to groups accessible to the user of the GITLAB_TOKEN.

    Migrated projects can be automatically archived on gitlab to avoid users pushing there commits after the migration to gitea. (Set GITLAB_ARCHIVE_MIGRATED_PROJECTS to "1" if you wish to do that (i did not test it))




5. Building the Dockerfile and running:

docker compose build
docker compose up

It should now start scanning for users and repos for migration. Give it a little time and check back when its done.

After its done you can check if all users and repos were synced successfully. In my case there were a few repos i had to manually import. In order to do that you have to go to
-> Site Administration -> Organizations -> Select the one where something is missing -> "New Migration".
Everything after that should be self explanatory.

If anything is unclear or you want to add something please register an account and comment under this post. Im happy to help!

- https://blog.kronis.dev/tutorials/moving-from-gitlab-to-gitea
- https://github.com/h44z/gitlab_to_gitea