Backing up your n8n workflows shouldn’t be a manual chore. By automating n8n Workflow Backups with GitLab, you can schedule, version, and store your workflows in GitLab seamlessly. In this post, we’ll walk through a custom n8n workflow that handles the entire backup process for you — from fetching workflows to syncing them with GitLab.

How It Works

This automation is designed to run either manually or on a daily schedule (03:00 by default). Here’s what it does step by step:

  1. Fetch tagged workflows
    • Queries the n8n API for workflows tagged with backup-workflows.
    • Ensures only workflows you’ve explicitly marked for backup are included.
  2. Normalize workflow names & tags
    • Cleans workflow names for consistency.
    • Applies the [client: NAME] convention for better organization.
  3. Prepare export JSON
    • Formats each workflow into the same structure you’d see if exporting from the n8n UI.
  4. Sync with GitLab
    • Checks if the file already exists in your GitLab repository.
    • Creates a new file if missing.
    • Updates the file if there are changes.
    • Skips the file if unchanged.
  5. Logging & recap
    • At the end of the run, the workflow logs how many backups were created, updated, or skipped.

Setup Steps

To get this running in your own environment, follow these steps:

  1. Configure GitLab credentials in n8n
    • Add your GitLab personal access token to n8n credentials.
  2. Prepare your repository
    • Create a GitLab repository and branch where backups will be stored.
  3. Set global variables
    • Define owner, project, branch, and backup path inside the workflow.
  4. Tag your workflows
    • Add the backup-workflows tag to any workflow you want included in the backup.
  5. Test & enable
    • Run the workflow manually once to confirm everything works.
    • Then, enable the schedule to let it run daily at 03:00.

Why This Matters

Version control: Every change is tracked in GitLab.

Disaster recovery: Easily restore workflows if something goes wrong.

Team collaboration: Share, review, and merge workflow changes just like code.

Final Thoughts

With this n8n → GitLab backup automation, you can sleep easy knowing your workflows are safe, versioned, and always up to date. Whether you run it daily or on-demand, this setup turns backups from a manual task into a hands-free safety net.

📥 Download the Workflow JSON
You can grab the ready-to-use n8n workflow file here:
⬇️ Download Backup Workflow JSON

🚀 Want to see it in action?
👉 Book a live demo and we’ll walk you through setting up automated n8n workflow backups with GitLab, step by step.

Leave a Comment