n8n

How to Sync GitLab n8n Workflow Versioning?

Keep every n8n workflow backed up and versioned in GitLab without manual exports. Teams get a clear record of changes, simple rollback options, and a clean audit trail for reviews and handoffs.

The run starts on click, pulls all workflows from your n8n instance, and loops through them one by one. For each workflow, it checks if a JSON snapshot already exists in GitLab. If no file is found, it marks it as new and creates a JSON file. If a file exists, it extracts the stored JSON and compares it with the live version. Based on the result, it either updates the file, skips when nothing changed, or logs an error. A Switch node handles these paths, and GitLab commits include a clear message per workflow. Global settings hold the repo owner, name, branch, and path so you configure once and reuse across all items.

You need a GitLab repo and token, plus an n8n API key. Set the Globals for owner, repo, branch, and path, then click Test. Expect most exports to complete in minutes and reduce manual effort by a large margin. Great for governance, audits, disaster recovery, and team collaboration on automation assets.

What are the key features?

  • Manual start that lets you control when backups run
  • Retrieves all workflows from your n8n instance using the n8n API
  • Batch loop processes each workflow safely without timeouts
  • Checks GitLab for an existing JSON file per workflow and extracts stored data
  • Code step sets status to new, diff, same, or error based on file checks and comparison
  • Switch node routes to create new files, update existing ones, or skip when nothing changed
  • GitLab commits include clear messages and author details for easy history
  • Global settings store repo owner, name, branch, and path for quick reuse
  • Error path handles not found as new so missing files are created
  • Final loop finish ensures every workflow is processed once

What are the benefits?

  • Reduce manual export work from hours to minutes by automating all n8n workflow backups
  • Improve version accuracy by storing clean JSON snapshots for every workflow
  • Handle large libraries with a batching loop that scales to hundreds of workflows
  • Connect n8n and GitLab so teams track changes in one place
  • Cut change review time by routing same, new, or diff outcomes automatically

How do you set it up?

  1. Import the template into n8n: Create a new workflow in n8n > Click the three dots menu > Select 'Import from File' > Choose the downloaded JSON file.
  2. You'll need accounts with GitLab and n8n. See the Tools Required section above for links to create accounts with these services.
  3. In the n8n credentials manager, create GitLab credentials. Double click any GitLab node, open the Credential to connect with menu, click Create new credential, and follow the on screen steps. Use a Personal Access Token with read repository and write repository scopes.
  4. Create n8n API credentials. Double click the Retrieve all workflows node, open the credentials dropdown, click Create new credential, and follow the on screen steps. In n8n Cloud, copy your API key from Personal Settings and paste it into the credential.
  5. Open the Globals Set node. Fill repo.owner, repo.name, repo.branch, and repo.path. Repo path should include any folder and a trailing slash if you want files in a subfolder.
  6. Confirm the GitLab branch exists and the path folder is created in the repo. Create the folder first if your GitLab setup requires it.
  7. Open the Retrieve all workflows node and keep the default to fetch all workflows. If needed, apply filters later to limit the export.
  8. Click Test Workflow. Watch the execution. The loop will process each workflow and either create, update, or skip the file in GitLab.
  9. In GitLab, check the target folder. You should see one JSON file per workflow named with the workflow id.
  10. Make a small change to any workflow in n8n and run the test again. Confirm an edit commit was made for that workflow and that unchanged items were skipped.
  11. If you see permission errors, verify the GitLab token scopes. If files are not found, that is expected for new items and they will be created. If the branch is wrong, update repo.branch in the Globals node.
  12. Optional tuning: adjust SplitInBatches size for large sets, update commit author fields in GitLab nodes, or point repo.branch to a staging branch before merging.

Tools Required

$24 / mo or $20 / mo billed annually to use n8n in the cloud. However, the local or self-hosted n8n Community Edition is free.

GitLab

Sign up

Free: $0/user / mo (GitLab.com). API access via Personal Access Tokens on Free tier

n8n API

Sign up

Community Edition (self-hosted): $0 (public REST API available). Cloud Starter: $20 / mo billed annually ($24 monthly); API unavailable during free trial.

Similar Templates

Join Futurise to access 1,200+ automation templates

Get instant access to ready-made automation workflows for n8n, Make.com, AI agents, and more. Download, customise, and deploy in minutes.