n8n

How to Automate GitLab n8n Workflow Backups?

Keep safe copies of your n8n workflows in GitLab, on a schedule or on demand. It is built for IT and operations teams that want version control and a clear audit trail without manual exports.

A schedule or manual start loads shared settings from the Globals node. The n8n node pulls only workflows that match a chosen tag. The flow creates a clean filename from each workflow name, gets the list of files in the GitLab repo, and checks if a match already exists. If a file is found, it fetches the current content and compares it to the new JSON. Files that did not change are skipped. New or updated items are committed to the main branch with time stamped messages.

Set your GitLab owner, project, branch, and folder path in the Globals node, and pick the tag used for backups. Tag the workflows you want to protect and set the schedule. You get faster backups, fewer errors, and simple restore from GitLab history. This helps teams with many automations or strict change control keep stable and recoverable operations.

What are the key features?

  • Manual and scheduled triggers let you run backups now or at set times.
  • Tag based selection backs up only workflows that match your chosen tag.
  • Filename normalization removes special characters and saves as JSON.
  • GitLab file lookup checks if a file already exists before writing.
  • Content comparison skips unchanged files to reduce needless commits.
  • Creates new files or edits existing ones with clear time stamped messages.
  • Globals node stores owner, project, branch, path, tags, and time data in one place.

What are the benefits?

  • Reduce manual export work from hours to minutes each run
  • Automate 100 percent of workflow backups on a fixed schedule
  • Cut commit noise by skipping unchanged files by up to 60 percent
  • Improve restore accuracy with versioned JSON stored in GitLab
  • Connect n8n and GitLab so backups live with your code

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 will need accounts with n8n and GitLab. See the Tools Required section above for links to create accounts with these services.
  3. Open the n8n node and set up the n8n API credential. Double click the node, then on the Credential to connect with dropdown, click Create new credential, then follow the on screen instructions. Use your n8n base URL and an API key from your n8n account if prompted.
  4. Open any GitLab node and create a GitLab credential. Double click the node, choose Create new credential, and enter a Personal Access Token from GitLab with api and write_repository scopes. Name the credential clearly for your team.
  5. Open the Globals node and fill in gitlab_owner, gitlab_project, gitlab_workflow_path, branch if needed, tags_to_match_for_backup, and any time or execution fields used in commit messages.
  6. In your source n8n instance, add the chosen tag to every workflow you want to back up. Only tagged items will be included.
  7. Open the Schedule Trigger and set the timing that fits your policy. Choose minutes, hourly, daily, or a cron style rule.
  8. Check the GitLab nodes for owner, project, branch main, and the file path template. Confirm they read values from the Globals node as shown.
  9. Click Backup Now Manual Trigger and run once to test. Confirm the execution completes without errors in n8n.
  10. Open your GitLab repo and check the target folder. You should see JSON files named after each workflow with a commit message that includes the execution type and time.
  11. Test change detection. Run again without any workflow edits and confirm no new commits appear. Make a small change to a tagged workflow, run again, and confirm only that file updates.
  12. Troubleshoot common issues. For 401 errors, verify tokens and scopes. For 404 errors, confirm the folder path and branch exist. If no files are created, check that the tag in Globals matches the tags on your workflows. If filenames look odd, review the filename rule in the Derive Filename From Workflow Name node.

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.