Automate GitLab Backup with n8n Command Nodes

This workflow automates backing up n8n workflows and credentials to a GitLab repo on a schedule or manual trigger, saving hours and avoiding data loss. Learn step-by-step how to use command nodes in n8n to export, commit, and push your backups effortlessly.
manualTrigger
executeCommand
cron
Workflow Identifier: 1421
NODES in Use: Manual Trigger, Execute Command, Cron

Press CTRL+F5 if the workflow didn't load.

Learn how to Build this Workflow with AI:

Visit through Desktop for Best experience

What this workflow does

This workflow saves your n8n workflows and credentials to a GitLab repository automatically.

It fixes the problem of manual exports that waste time and can miss backups.

When it runs, it exports, commits, and pushes data to keep backups safe without you doing anything.

Who should use this workflow

Anyone who runs multiple workflows in n8n and needs regular backups.

It helps automation users who want to stop spending hours backing up and avoid human errors.

Users who want guaranteed, scheduled backups in GitLab will find this useful.

Tools and services used

  • n8n platform: runs the automation workflow.
  • GitLab repository: stores the backed-up workflows and credentials.
  • Execute Command nodes: run CLI commands inside n8n to export and manage git.
  • Git: tracks and pushes changes to GitLab remotely.
  • Cron node: triggers the backup job 4 times a day automatically.

Inputs, processing steps, and outputs

Inputs

  • This workflow needs access to your n8n instance where workflows and credentials are stored.
  • A configured GitLab repo with git credentials set in your n8n environment.

Processing steps

  • Four daily cron triggers start the workflow automatically.
  • Manual Trigger also allows instant backups whenever you run it manually.
  • Execute Command nodes export all workflows to repo/workflows/ folder.
  • Credentials export to repo/credentials/ folder securely.
  • Git add stages all changes in the repository.
  • Git commit records the backup with a current timestamp in the commit message.
  • Git push uploads the commit to the remote GitLab repository.

Outputs

  • Updated workflow and credential files backed up in the GitLab repository.
  • Timestamped git commits that show backup history clearly.
  • Automated backups occurring regularly without manual work.

Beginner step-by-step: How to use this workflow in n8n

1. Import the workflow

  1. Download the workflow file using the Download button on this page.
  2. Open the n8n editor where you want this backup to run.
  3. Use the “Import from File” option to add this workflow into your n8n instance.

2. Configure credentials and settings

  1. Add proper credentials or API Keys required by the workflow nodes.
  2. Check the git repository folder paths and update if your repo location is different.
  3. If needed, update any IDs, emails, or folder names specific to your environment.

3. Test the workflow

  1. Run the Manual Trigger node once to verify the export and git commands work correctly.
  2. Look for errors or missing files, fix permissions if needed.

4. Activate for production

  1. Once tests pass, toggle the workflow to active mode.
  2. The Cron node will run backups 4 times daily automatically.

If you manage a self-hosted n8n instance, consider self-host n8n options for full control.

Customization ideas

  • Change how often backups run by editing the cron trigger times.
  • Save backups in different folders by modifying export command paths.
  • Add information like project names in the commit messages for clarity.
  • Send email alerts after push by adding an email node after git push.

Common issues and solutions

“git commit” returns “nothing to commit, working tree clean”

This means no changes were found to save.

Check if the export commands actually created or updated files.

“git push” fails due to authentication

n8n might not be signed in to GitLab correctly.

Make sure SSH keys or access tokens are set up on the server running n8n.

Pre-production checklist

  • Run the n8n export commands manually on your server to confirm they work.
  • Check git commands in the repo folder to verify proper setup.
  • Test manual and scheduled triggers to see results without errors.
  • Confirm that backup folders repo/workflows and repo/credentials exist or can be created.

Summary of benefits

✓ Saves about 3-4 hours of manual backup work weekly.

✓ Avoids errors by automating export and git commands.

✓ Runs backups 4 times daily plus on demand for fresh data protection.

✓ Tracks backup versions with timestamped commit messages.

→ Ensures workflows and credentials are always safely backed up in GitLab.

→ Eliminates risk of lost automation settings and downtime.


Promoted by BULDRR AI

Related Workflows

Automate Viral UGC Video Creation Using n8n + Degaus (Beginner-Friendly Guide)

Learn how to automate viral UGC video creation using n8n, AI prompts, and Degaus. This beginner-friendly guide shows how to import, configure, and run the workflow without technical complexity.
Form Trigger
Google Sheets
Gmail
+37
Free

AI SEO Blog Writer Automation Workflows in n8n

A complete beginner guide to building an AI SEO blog writer automation using n8n.
AI Agent
Google Sheets
httpRequest
+5
Free

Automate CrowdStrike Alerts with VirusTotal, Jira & Slack

This workflow automates processing of CrowdStrike detections by enriching threat data via VirusTotal, creating Jira tickets for incident tracking, and notifying teams on Slack for quick response. Save hours daily by transforming complex threat data into actionable alerts effortlessly.
scheduleTrigger
httpRequest
jira
+5
Free

Automate Telegram Invoices to Notion with AI Summaries & Reports

Save hours on financial tracking by automating invoice extraction from Telegram photos to Notion using Google Gemini AI. This workflow extracts data, records transactions, and generates detailed spending reports with charts sent on schedule via Telegram.
lmChatGoogleGemini
telegramTrigger
notion
+9
Free

Automate Email Replies with n8n and AI-Powered Summarization

Save hours managing your inbox with this n8n workflow that uses IMAP email triggers, AI summarization, and vector search to draft concise replies requiring minimal review. Automate business email processing efficiently with AI guidance and Gmail integration.
emailReadImap
vectorStoreQdrant
emailSend
+12
Free

Automate Email Campaigns Using n8n with Gmail & Google Sheets

This n8n workflow automates personalized email outreach campaigns by integrating Gmail and Google Sheets, saving hours of manual follow-up work and reducing errors in email sequences. It ensures timely follow-ups based on previous email interactions, optimizing communication efficiency.
googleSheets
gmail
code
+5
Free