Automate Backup of n8n Workflows to Gitea Repository

Save time and minimize risk by automating n8n workflow backups to a Gitea Git repository. This workflow checks for changes and commits updates every 45 minutes, ensuring your workflows are always safely backed up.
set
httpRequest
if
+5
Workflow Identifier: 1736
NODES in Use: set, n8n, scheduleTrigger, stickyNote, code, if, httpRequest, splitInBatches
Automate n8n workflow backup to Gitea

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

Learn how to Build this Workflow with AI:

What This Automation Does

This workflow makes backups of n8n workflows in a Gitea Git repository automatically every 45 minutes.
It solves the problem of manual backup, reducing errors and saving time.
The result is a safe, versioned copy of all workflows with commits only when there are changes.

You don’t have to export manually and you avoid losing work or versions.


Step-by-Step Guide

Beginner Instructions: How To Use This Workflow in n8n

Download and Import

  1. Download the workflow file using the Download button on this page.
  2. Open the n8n editor where you manage workflows.
  3. Use “Import from File” to add the workflow to n8n.

Configure Settings

  1. Go to the Globals Set node and update your Gitea repo URL, name, and owner to match your repository.
  2. Add your Gitea API Key (Personal Access Token) in the GetGitea, PostGitea, and PutGitea HTTP Request nodes using the provided credential input.
  3. Check your n8n API credentials are correct in the n8n node that fetches workflows.

Test and Activate

  1. Run the workflow manually once to confirm data retrieval and commits work.
  2. Look for new or updated workflow JSON files in your Gitea repo.
  3. Activate the Schedule Trigger node to start automatic backups every 45 minutes.

This simple process sets up automated backup without building from scratch.

For help on self hosting n8n safely, see self-host n8n.


Workflow Inputs, Processing, and Outputs

Inputs

Processing Steps

  • Trigger runs every 45 minutes.
  • Split workflows into single batches.
  • Get file info from the Gitea repo by workflow name.
  • Check if file exists or needs to be created.
  • Serialize and Base64 encode workflow JSON using Python code.
  • Compare new and existing Base64 content to detect changes.
  • POST new files or PUT updates to Gitea repo.
  • Continue loop for all workflows.

Output


Who Should Use This Workflow

This workflow is for anyone running many n8n workflows who wants regular, automatic backups.

It helps teams using self-host n8n or on cloud instances.

Also good if backups and version control of workflows are important but manual exporting is slow or error-prone.


Tools and Services Used

  • n8n API: To fetch workflows.
  • Gitea API: To read, create, and update files in repository.
  • HTTP Request node: For API calls to Gitea.
  • Base64 encoding (Python code node): For file content encoding.
  • Schedule Trigger node: To run the workflow automatically.

Customizations

  • Change backup frequency in the Schedule Trigger node.
  • Set multiple repositories by adding more repo info in the Globals Set node and loop through them.
  • Add timestamps or folders by editing file names in GetGitea, PostGitea, and PutGitea nodes.
  • Add Slack or Email nodes at the end to get notifications.

Common Issues and Fixes

  • 404 error checking file: Normal on first backup for new workflows. Workflow logic creates new files.
  • No commits on changed workflows: Usually due to Base64 comparison issues. Check JSON formatting.

Pre-Production Checklist

  • Check Gitea API URL is correct.
  • Confirm Gitea personal access token has write rights.
  • Test the workflow manually before activating scheduled runs.
  • Make sure Base64 encoding runs without errors.
  • Verify the logic correctly checks file existence and changes.
  • Watch commit results appear in the Gitea repository.

Deployment Guide

After testing, activate the Schedule Trigger node.

Monitor workflow runs in the n8n UI.

Watch the Gitea repo for updated workflow backups.


Summary and Results

✓ Automates backup of all n8n workflows into Gitea every 45 minutes.

✓ Avoids manual export errors and saves time.

✓ Only commits workflows when content changes.

→ Gives safe, versioned backups and peace of mind for automation users.


Automate n8n workflow backup to Gitea

Visit through Desktop to Interact with the Workflow.

Frequently Asked Questions

The workflow compares the Base64-encoded content of the current workflow JSON with the existing file in Gitea and only commits if the content is different.
A 404 means the file does not exist yet in the repository, which is normal for new workflows. The workflow then creates the new file automatically.
Yes, it works with self-hosted n8n setups. The user should configure API access and credentials properly. See https://buldrr.com/hosting/ for help on self-hosting n8n.
The workflow requires an n8n API Key for workflow retrieval and a Gitea Personal Access Token with repository read and write permissions.

Promoted by BULDRR AI

Related Workflows

Automate Twist Channel Creation and Messaging with n8n

This workflow automates creating and updating a channel in Twist and sending a personalized message to specific users. It eliminates manual setup errors and saves time managing Twist communications.

Automate Ideogram Image Generation with Google Sheets & Gmail

This workflow automates graphic design image generation via Ideogram AI, storing image data in Google Sheets and Google Drive, with email alerts via Gmail. It saves designers hours by automating image creation, remixing, review, and record-keeping.

Automate IT Support with Slack and OpenAI in n8n

Streamline IT support by automating Slack message handling using n8n and OpenAI. This workflow handles Slack DMs, filters bots, queries a Confluence knowledge base, and delivers AI-generated responses, improving support efficiency and response time.

Automate Crypto Analysis with CoinMarketCap & n8n AI Agent

Discover how this unique n8n workflow leverages CoinMarketCap’s multi-agent AI to deliver precise, real-time cryptocurrency insights directly via Telegram. Manage crypto data analysis efficiently with automated multi-source API integration.

Automate Gumroad to Beehiiv Subscriber Sync with n8n

Learn how to automatically add new Gumroad sales customers as Beehiiv newsletter subscribers using n8n automation. This workflow saves time by syncing sales data to Google Sheets CRM and notifying your Telegram channel instantly.

Generate On-Brand Blog Articles Using n8n and OpenAI

This workflow automates the creation of on-brand blog articles by analyzing existing company content using n8n and OpenAI. It extracts article structures and brand voice to produce consistent draft articles, saving significant content creation time.
1:1 Free Strategy Session
Your competitors are already automating. Are you still paying for it manually?

Do you want to adopt AI Automation?

Every hour your team does repetitive work, you're burning real money.
While you wait, faster businesses are cutting costs and moving quicker.
AI and automations aren't the future anymore — they're the present.

Book a live 1-on-1 session where we show you exactly which of your daily tasks can be automated — and what it’s costing you not to.