GitHub + Gmail backups you can restore with confidence
You upgrade n8n, migrate servers, or “clean up” an instance. Then the stomach-drop moment: a workflow is missing, the export you thought you had is outdated, and the one person who “knows how it works” is offline.
Marketing ops teams feel it when lead routing or reporting automations disappear. Agency owners feel it when a client’s entire delivery pipeline can’t be restored. And if you run a small business, you feel it because you do not have time for rebuilds. This GitHub Gmail backups automation gives you a repeatable, versioned backup you can actually trust.
Below is the workflow at a glance, what it solves, and how it turns “I hope we can restore” into “we can restore in minutes.”
How This Automation Works
The full n8n workflow, from trigger to final output:
n8n Workflow Template: GitHub + Gmail backups you can restore with confidence
flowchart LR
subgraph sg0["When clicking ‘Test workflow’ Flow"]
direction LR
n0@{ icon: "mdi:play-circle", form: "rounded", label: "When clicking ‘Test workflow’", pos: "b", h: 48 }
n1["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/code.svg' width='40' height='40' /></div><br/>Create_Backup_Package"]
n2["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/httprequest.dark.svg' width='40' height='40' /></div><br/>Get_Workflows"]
n3["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/httprequest.dark.svg' width='40' height='40' /></div><br/>Check_Repository_Exists"]
n4@{ icon: "mdi:swap-horizontal", form: "rounded", label: "If_Repo_Not_Exists", pos: "b", h: 48 }
n5["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/code.svg' width='40' height='40' /></div><br/>Clean_Workflows"]
n6["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/httprequest.dark.svg' width='40' height='40' /></div><br/>Create_Repository"]
n7["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/code.svg' width='40' height='40' /></div><br/>Split_Workflow_Files"]
n8["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/code.svg' width='40' height='40' /></div><br/>Backup_Complete_Summary"]
n9["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/httprequest.dark.svg' width='40' height='40' /></div><br/>Upload_Workflow_Files"]
n10["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/httprequest.dark.svg' width='40' height='40' /></div><br/>Upload_README"]
n11["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/httprequest.dark.svg' width='40' height='40' /></div><br/>Upload_Manifest"]
n12@{ icon: "mdi:swap-vertical", form: "rounded", label: "Loop_Workflow_Uploads", pos: "b", h: 48 }
n14["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/code.svg' width='40' height='40' /></div><br/>Backup_Config"]
n16@{ icon: "mdi:message-outline", form: "rounded", label: "Gmail - Notification", pos: "b", h: 48 }
n14 --> n2
n2 --> n5
n10 --> n7
n5 --> n1
n11 --> n10
n6 --> n11
n4 --> n6
n4 --> n11
n7 --> n12
n1 --> n3
n12 --> n8
n12 --> n9
n9 --> n12
n8 --> n16
n3 --> n4
n0 --> n14
end
subgraph sg1["Flow 2"]
direction LR
n13["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/telegram.svg' width='40' height='40' /></div><br/>Send_Backup_Notification"]
end
subgraph sg2["Daily Flow"]
direction LR
n15@{ icon: "mdi:play-circle", form: "rounded", label: "Daily", pos: "b", h: 48 }
end
%% Styling
classDef trigger fill:#e8f5e9,stroke:#388e3c,stroke-width:2px
classDef ai fill:#e3f2fd,stroke:#1976d2,stroke-width:2px
classDef aiModel fill:#e8eaf6,stroke:#3f51b5,stroke-width:2px
classDef decision fill:#fff8e1,stroke:#f9a825,stroke-width:2px
classDef database fill:#fce4ec,stroke:#c2185b,stroke-width:2px
classDef api fill:#fff3e0,stroke:#e65100,stroke-width:2px
classDef code fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px
classDef disabled stroke-dasharray: 5 5,opacity: 0.5
class n0,n15 trigger
class n4 decision
class n2,n3,n6,n9,n10,n11 api
class n1,n5,n7,n8,n14 code
classDef customIcon fill:none,stroke:none
class n1,n2,n3,n5,n6,n7,n8,n9,n10,n11,n14,n13 customIcon
The Problem: Backups That Fail When You Need Them
Most “backup plans” for n8n are really just habits. Someone exports a workflow occasionally. Maybe it gets dropped into a shared drive. Then you upgrade, move to a new instance, or import a few workflows and overwrite something important. Suddenly you’re hunting for the latest version, comparing files by hand, and trying to remember what changed. The time loss is obvious, but the bigger cost is uncertainty. When you’re not sure you can restore, you hesitate to improve anything.
It adds up fast. Here’s where it breaks down in real life:
- Manual exports get forgotten, so the “latest backup” is often weeks old.
- One giant export file is hard to review, which makes version control basically useless.
- During a migration, you discover missing workflows only after something stops running.
- Teams hesitate to refactor because nobody wants to be the person who broke production.
The Solution: Automatic n8n Workflow Backups to GitHub + Gmail
This workflow pulls every workflow from your n8n instance using the n8n API, cleans up the data so it exports consistently, and then packages it in a way you can restore confidently. Instead of storing a single messy blob, it splits workflows into separate JSON files, then pushes them into a GitHub repository so you get real version history. If the target repo does not exist yet, it creates it for you, then uploads a manifest and a README so the backup is self-explanatory later. After uploads finish, it compiles a clear summary and emails it through Gmail, so you know the backup happened and what was included. Quiet, reliable, and honestly hard to mess up once it’s running.
The workflow starts on a manual trigger (and includes a daily schedule trigger you can enable). It retrieves and sanitizes workflows, then checks GitHub for the repository and creates it if needed. Finally, it uploads the manifest, README, and each workflow file, then sends a Gmail summary (or Telegram if you prefer) after the run completes.
What You Get: Automation vs. Results
| What This Workflow Automates | Results You’ll Get |
|---|---|
|
|
Example: What This Looks Like
Say your instance has 40 workflows. A “responsible manual backup” usually means exporting, naming files, uploading somewhere, and writing notes, which can easily take about 2 hours if you want it done properly. With this workflow, you kick it off (or schedule it), wait a few minutes for GitHub uploads, and you get a Gmail summary when it’s finished. The human time drops to roughly 5 minutes, and you stop gambling with outdated exports.
What You’ll Need
- n8n instance (try n8n Cloud free)
- Self-hosting option if you prefer (Hostinger works well)
- GitHub to store backups with version history
- Gmail to receive a summary after each run
- n8n API access (generate it in your n8n user settings)
Skill level: Intermediate. You’ll paste API keys, connect accounts, and adjust a few settings fields confidently.
Don’t want to set this up yourself? Talk to an automation expert (free 15-minute consultation).
How It Works
A trigger starts the backup. You can run it manually when you’re testing, then switch to the included daily schedule trigger once you trust the output.
Your n8n instance is queried for workflows. The workflow calls the n8n API (via HTTP Request), retrieves all workflows, then cleans and normalizes the JSON so the exported files stay consistent from run to run.
GitHub is prepared, then files are uploaded in batches. It checks whether the target repository exists, creates it if it doesn’t, and uploads a manifest plus a README. Then it splits workflows into individual JSON files and loops through them (Split in Batches) to upload each one.
You get a completion summary in Gmail. After the loop finishes, the workflow compiles a backup summary and sends an email so you know exactly what happened without opening n8n.
You can easily modify the target repository naming and the notification channel based on your needs. See the full implementation guide below for customization options.
Step-by-Step Implementation Guide
Step 1: Configure the Manual Trigger
This workflow starts manually and then proceeds through the backup pipeline. You can also add a scheduled trigger for daily runs.
- Add the Manual Start Trigger node as the entry point of the workflow.
- (Optional) Add Utility: Daily Schedule Trigger if you want automated daily backups.
- Connect Manual Start Trigger to Configure Backup Settings.
Step 2: Define Backup Parameters and Retrieve Workflows
These nodes set up configuration values and pull workflows from your n8n instance.
- Open Configure Backup Settings and add the code that defines backup destination details (such as repository name, owner, or API base URL).
- Connect Configure Backup Settings to Retrieve Workflows.
- In Retrieve Workflows, configure the HTTP request to the n8n API that returns workflow JSON.
Step 3: Clean and Package Workflow Data
These code nodes sanitize workflow JSON and assemble the backup payload.
- Connect Retrieve Workflows to Sanitize Workflow Data and implement logic that strips or normalizes sensitive fields.
- Connect Sanitize Workflow Data to Assemble Backup Bundle and assemble the final backup object that includes workflow files and metadata.
Step 4: Verify or Create the Repository and Publish Manifests
The workflow checks for a repository, creates it if missing, then posts manifest and README files.
- Connect Assemble Backup Bundle to Verify Repo Presence and configure the repo-check HTTP request.
- Connect Verify Repo Presence to Branch If Repo Missing so the workflow can decide whether to create a repository.
- On the “true” path, connect Branch If Repo Missing to Generate Repository and configure the repository creation request.
- Connect Generate Repository to Post Manifest File and then to Post README File to publish top-level metadata files.
- On the “false” path, connect Branch If Repo Missing directly to Post Manifest File so existing repos skip creation.
Step 5: Upload Workflow Files in Batches
This section splits workflow files into upload-ready chunks and iterates over them.
- Connect Post README File to Divide Workflow Files and implement logic that creates a list of workflow file objects.
- Connect Divide Workflow Files to Iterate File Uploads to process uploads in batches.
- Connect Iterate File Uploads to Upload Workflow Assets to send each file to your repository API.
- Connect Upload Workflow Assets back to Iterate File Uploads to continue the batch loop.
Step 6: Compile Summary and Send Notifications
After file uploads, the workflow summarizes the backup and emails results.
- Connect Iterate File Uploads to Compile Backup Summary to build a completion summary.
- Connect Compile Backup Summary to Dispatch Email Notice to email the report.
- (Optional) Use Utility: Telegram Backup Alert for instant notifications by connecting it to Compile Backup Summary.
- Credential Required: Connect your Gmail credentials in Dispatch Email Notice.
- Credential Required: Connect your Telegram Bot API credentials in Utility: Telegram Backup Alert.
Step 7: Test and Activate Your Workflow
Run a controlled test to validate repository creation, uploads, and notifications.
- Click Execute Workflow from Manual Start Trigger to run a test backup.
- Verify that Verify Repo Presence and Generate Repository behave correctly for existing vs. missing repos.
- Confirm that files are uploaded by checking outputs from Upload Workflow Assets and the repository contents.
- Ensure Dispatch Email Notice sends a summary email and (if used) Utility: Telegram Backup Alert posts a message.
- When satisfied, set the workflow to Active so scheduled or manual runs are production-ready.
Common Gotchas
- GitHub credentials can expire or need specific permissions. If things break, check your GitHub Personal Access Token scopes and the n8n credential settings first.
- If you’re using Wait nodes or external rendering, processing times vary. Bump up the wait duration if downstream nodes fail on empty responses.
- Default prompts in AI nodes are generic. Add your brand voice early or you’ll be editing outputs forever.
Frequently Asked Questions
About 30 minutes if your n8n API and GitHub token are ready.
No. You’ll connect accounts and paste API keys. The included code nodes are already written, so you’re mostly configuring.
Yes. n8n has a free self-hosted option and a free trial on n8n Cloud. Cloud plans start at $20/month for higher volume. You’ll also need to factor in GitHub (usually free) and Gmail (free) unless your org has paid plans.
Two options: n8n Cloud (managed, easiest setup) or self-hosting on a VPS. For self-hosting, Hostinger VPS is affordable and handles n8n well. Self-hosting gives you unlimited executions but requires basic server management.
Yes, but… keep the Gmail node if you want an inbox record. This workflow already includes a Telegram alert path (look for the Telegram Backup Alert node), so you can enable that and disable the Dispatch Email Notice node. Common customizations include changing the repository name in the Configure Backup Settings code node, adding a date-based folder structure in the upload step, and switching the schedule from daily to hourly for fast-moving teams.
Usually it’s an expired or under-scoped GitHub token. Regenerate your Personal Access Token, confirm it can create repos and write contents, then update the credential in n8n. If it only fails on some runs, check GitHub rate limits and make sure your repo owner/name matches what the workflow is checking for.
A few hundred is normal on a small VPS.
For this specific job, n8n is usually the better fit. You need looping, file handling, and conditional logic (like “create the repo if it doesn’t exist”), which is awkward and pricey in many no-code tools. Self-hosting also means you’re not paying per tiny step when you back up dozens of workflows. Zapier or Make can still work if you only want a basic “export and email me” flow, but it won’t feel like a real restore plan. Talk to an automation expert if you want help choosing.
Backups should feel boring, because boring means reliable. Set this up once, and the next upgrade won’t turn into a late-night rebuild.
Need Help Setting This Up?
Our automation experts can build and customize this workflow for your specific needs. Free 15-minute consultation—no commitment required.