Automated Repository Migration from GitLab Groups to Gitea Organizations - n8n Workflow

Migrate all repositories from a GitLab group to a Gitea organization automatically using this efficient n8n workflow. Includes error handling and dynamic API requests for seamless migration.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • DevOps Engineers and System Administrators managing version control system migrations.

  • Technical teams requiring automated, bulk repository transfer capabilities.

  • Users looking for advanced n8n templates demonstrating complex API interaction and error handling.

  • Anyone needing a reliable, self-hosted solution via n8n to manage code migration.

Overview

This professional n8n workflow solves the complex challenge of migrating multiple code repositories between Git hosting platforms. Specifically designed for moving repositories from a GitLab Group to a Gitea Organization, this n8n automation template handles the entire process—from bulk fetching project lists (with full pagination support) to conditional migration based on existence checks. By using sophisticated flow control and API calls, this n8n workflow ensures that only missing repositories are migrated, preventing duplication and standardizing the migration process. It's a prime example of a robust n8n node structure built for critical infrastructure operations.

How it Works

This efficient n8n workflow executes a multi-step migration process, triggered manually for control:


  1. Start and Setup: The process begins with the ManualTrigger n8n trigger. The subsequent Setup (CHANGE ME) n8n node initializes critical configuration variables, including the GitLab Access Token, the source GitLab group path name, and the target Gitea organization path name. This ensures the rest of the n8n workflow uses consistent parameters.

  2. Fetch GitLab Projects: The Gitlab: Get projects n8n node calls the GitLab API to retrieve a list of all projects within the defined group path. Crucially, this n8n node is configured to handle API pagination automatically, guaranteeing that every single repository, regardless of the group size, is captured.

  3. Iteration: The Loop Over Items n8n node iterates through the array of projects returned by GitLab, processing each repository migration sequentially.

  4. Existence Check: The Gitea: Search for repo n8n node attempts to retrieve the repository from the target Gitea organization. This n8n node is configured to allow errors to continue the output flow, specifically to capture 404 errors when the repository does not exist.

  5. Conditional Routing: The Switch error codes n8n node inspects the status code resulting from the search attempt. If the status is 404 (Repository Not Found), the flow proceeds to the migration step. If any other error code is detected, the flow is routed to the Stop and Error n8n node, halting the n8n workflow due to an unexpected issue.

  6. Execute Migration: If the 404 condition is met, the Gitea: Migrate repo n8n node executes a highly detailed POST request to the Gitea API's migration endpoint. It uses dynamic data derived from the current GitLab item (clone URL, description, repository name) and the stored GitLab access token (for Gitea to authenticate against GitLab) to ensure a complete migration, including features like issues, milestones, and pull requests. The successful execution loops back to the start of the next item in the Loop Over Items n8n node.

Installation Guide

To use this powerful n8n workflow template, follow these steps:


  1. Import: Copy the provided n8n workflow JSON and paste it directly into your n8n canvas using the 'Import from JSON' function.

  2. Credentials Setup:

GitLab Credential: Set up an HTTP Header Auth credential for gitlab.com access. This requires a GitLab Personal Access Token with the necessary scope (e.g., api scope).
Gitea Credential: Set up a separate HTTP Header Auth credential for your Gitea domain (e.g., gitea.example.com). This requires a Gitea Access Token.

  1. Configure Parameters: Open the Setup (CHANGE ME) n8n node and update the following values:

gitlabAccessToken: Your actual GitLab Personal Access Token.
gitlabGroupPathName: The path name of the source group in GitLab (e.g., my-company/team-dev).
* giteaOrganizationPathName: The path name of the target organization in Gitea (e.g., new-org).

  1. Update URLs: Ensure the URLs in the Gitea: Search for repo and Gitea: Migrate repo n8n nodes are updated from https://gitea.example.com/ to your actual Gitea instance domain.

  2. Execution: After configuration, run the n8n workflow by clicking 'Execute workflow' on the When clicking ‘Execute workflow’ n8n trigger.

Node Details

Manual Trigger: The starting n8n trigger for immediate execution.
Setup (CHANGE ME) (Set): Defines global variables used throughout the n8n workflow, including the GitLab token and source/target organization paths. Key configurations: Defines gitlabAccessToken, gitlabGroupPathName, and giteaOrganizationPathName.
Gitlab: Get projects (HTTP Request): Fetches all repositories from the specified GitLab group. Key Configuration: Uses pagination logic (x-next-page and x-total-pages headers) to retrieve data efficiently, making this n8n node scalable.
Loop Over Items (Split In Batches): Processes the list of GitLab projects one by one, enabling iterative logic for each repository.
Gitea: Search for repo (HTTP Request): Checks for the existence of the repository in the Gitea organization. Key Configuration: onError: continueErrorOutput is essential to catch 404 errors without stopping the n8n workflow execution.
Switch error codes (Switch): A core logic n8n node that routes the workflow path based on API response status. Key Configuration: Checks if {{ $json.error.status }} equals 404.


  • Gitea: Migrate repo (HTTP Request): Executes the migration via a POST request to the Gitea API. Key Configuration: The JSON body is dynamically constructed using data from the GitLab item (e.g., cloneaddr, reponame) and specifies that issues, pull requests, releases, and wikis should be migrated.

Related n8n Workflows

Free

Nodes: 6 Nodes
Updated: December 26 2025
View all
Created by
nepomuc
nepomuc

Featured*