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


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)
    https://gitlab.com/-/profile/personal_access_tokens
    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
    https://github.com/h44z/gitlab_to_gitea

  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))
GITLAB_URL=https://gitlab.com
GITLAB_TOKEN=

GITLAB_ADMIN_USER=
GITLAB_ADMIN_PASS=

GITEA_URL=https://gitea.example.com
GITEA_TOKEN=

MIGRATE_BY_GROUPS=1
GITLAB_ARCHIVE_MIGRATED_PROJECTS=0

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!


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