GitHub backups that keep your team changes traceable
You change a workflow, it works, and then a week later something breaks. Now you’re digging through exports, Slack messages, and old screenshots trying to remember what changed.
This is the kind of mess Ops leads get dragged into first. Agency owners feel it when a client automation mysteriously “stops.” And internal RevOps teams end up paying the bill in lost time. With GitHub backup automation, you get versioned workflow files that stay traceable, so rollbacks stop being a panic event.
This workflow backs up every n8n workflow to GitHub as a JSON file, then only commits when something actually changes. You’ll see what it does, why it matters, and how to run it safely.
How This Automation Works
The full n8n workflow, from trigger to final output:
n8n Workflow Template: GitHub backups that keep your team changes traceable
flowchart LR
subgraph sg0["Schedule Flow"]
direction LR
n0["<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/github.dark.svg' width='40' height='40' /></div><br/>GitHub"]
n1@{ icon: "mdi:swap-vertical", form: "rounded", label: "Globals", pos: "b", h: 48 }
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/n8n.svg' width='40' height='40' /></div><br/>n8n"]
n3@{ icon: "mdi:swap-vertical", form: "rounded", label: "Loop Over Items", pos: "b", h: 48 }
n4@{ icon: "mdi:swap-horizontal", form: "rounded", label: "If", pos: "b", h: 48 }
n5@{ icon: "mdi:swap-horizontal", form: "rounded", label: "If1", pos: "b", h: 48 }
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/code.svg' width='40' height='40' /></div><br/>Code"]
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/github.dark.svg' width='40' height='40' /></div><br/>Create new file and commit"]
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/github.dark.svg' width='40' height='40' /></div><br/>Update file content and commit"]
n9@{ icon: "mdi:play-circle", form: "rounded", label: "Schedule Trigger", pos: "b", h: 48 }
n4 --> n6
n4 --> n7
n5 --> n8
n5 --> n3
n2 --> n3
n6 --> n5
n0 --> n4
n1 --> n2
n3 --> n0
n9 --> n1
n7 --> n3
n8 --> n3
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 n9 trigger
class n4,n5 decision
class n6 code
classDef customIcon fill:none,stroke:none
class n0,n2,n6,n7,n8 customIcon
The Problem: Workflow changes aren’t traceable
Most teams treat automations like “set it and forget it,” right up until they don’t run. Then you realize there’s no reliable paper trail. Someone tweaked a node, updated a credential, renamed a workflow, or “just tested something quickly” in production. Exports exist, but they’re manual, inconsistent, and usually done after something already went wrong. Meanwhile, the business is stuck waiting while you try to reconstruct history from memory and guesswork.
The friction compounds. Here’s where it breaks down.
- Manual exports get skipped because they feel like extra work until the day they’re suddenly urgent.
- Two similar workflows can diverge quietly, and you don’t notice until results drift or failures spike.
- When a change causes a bug, you can’t quickly answer the basic question: “What changed since last week?”
- Restoring a known-good version turns into a time sink because you’re hunting for the right file in the right place.
The Solution: Automatically back up every n8n workflow to GitHub
This workflow turns your n8n instance into a system with memory. On a schedule you choose, it pulls your full workflow list from n8n, loops through each workflow, and saves it into a GitHub repository as a JSON file named [workflow_name].json. If the file doesn’t exist yet, it creates it with a commit. If it does exist, the workflow fetches the current file from GitHub, decodes it, compares it to the latest workflow JSON from n8n, then only commits an update when something actually changed. The end result is simple: a versioned backup trail that you can inspect, diff, and restore from without guessing.
The workflow starts with a Scheduled Run Trigger. From there, it initializes your repo settings, fetches workflows from n8n, and processes them in batches so it doesn’t choke on a long list. Each item is checked in GitHub, compared if it exists, then committed as a create or update. Clean, repeatable, and honestly calming when things go sideways.
What You Get: Automation vs. Results
| What This Workflow Automates | Results You’ll Get |
|---|---|
|
|
Example: What This Looks Like
Say you run 25 active workflows and you try to “be good” about weekly exports. Even at maybe 3 minutes each to export, name files, and store them, that’s about 75 minutes per week. And it still doesn’t capture mid-week edits. With this automation, you set a scheduled run (daily or a few times a week), and the only time you touch it is when you want to review a diff or restore a file. For most teams, that’s an hour back every week, plus much faster recovery when a change breaks production.
What You’ll Need
- n8n instance (try n8n Cloud free)
- Self-hosting option if you prefer (Hostinger works well)
- GitHub for storing backups with commit history
- GitHub repository to hold your workflow JSON files
- GitHub credential (create a PAT in GitHub Developer Settings)
Skill level: Intermediate. You’ll paste credentials, set a few global values, and test runs in n8n.
Don’t want to set this up yourself? Talk to an automation expert (free 15-minute consultation).
How It Works
A scheduled trigger kicks it off. You decide how often backups run (daily is common, but weekly works for low-change teams). The workflow starts automatically, so it doesn’t rely on anyone remembering to export.
Repository settings are loaded once. A setup step stores your GitHub owner, repo name, and the folder path where backups should land, which keeps the rest of the flow consistent.
n8n exports every workflow and processes them in batches. It fetches your workflow list, then loops through items using a batch approach so large accounts don’t time out or overload GitHub calls.
GitHub is checked, then updated only when needed. If the JSON file doesn’t exist, it creates a new file with a commit. If it exists, the workflow retrieves the current version, decodes it, compares it, and commits an update only when the content changed.
You can easily modify the schedule frequency to match your release cadence based on your needs. See the full implementation guide below for customization options.
Step-by-Step Implementation Guide
Step 1: Configure the Scheduled Trigger
Set up the schedule that initiates the backup run and kicks off repository settings initialization.
- Add and open Scheduled Run Trigger.
- Set Rule → Interval → Field to
minutesto define the run cadence. - Confirm the execution flow starts: Scheduled Run Trigger → Initialize Repo Settings.
Step 2: Connect GitHub and n8n
Connect the API services used to read workflows and write backups to your repository.
- Open Fetch Workflow List and set credentials. Credential Required: Connect your n8nApi credentials.
- Open Retrieve Repo File and set credentials. Credential Required: Connect your githubApi credentials.
- Open Create File Commit and set credentials. Credential Required: Connect your githubApi credentials.
- Open Update File Commit and set credentials. Credential Required: Connect your githubApi credentials.
[YOUR_ID]. Replace this with your GitHub username or organization before testing.
Step 3: Set Up Decode File Content Processing
Configure repository parameters, workflow iteration, and comparison logic that determines whether to create or update a backup file.
- Open Initialize Repo Settings and set repository fields: repo.owner to
[YOUR_ID], repo.name toworkflow-backups, and repo.path toworkflows/. - Open Fetch Workflow List to confirm it pulls workflows into the flow before Iterate Workflow Items.
- Open Iterate Workflow Items and leave batching defaults unless you want smaller batches.
- In Retrieve Repo File, ensure Owner is set to
={{$node["Initialize Repo Settings"].json["repo"]["owner"]}}, Repository to={{$node["Initialize Repo Settings"].json["repo"]["name"]}}, and File Path to={{$node["Initialize Repo Settings"].json["repo"]["path"]}}{{$json["name"]}}.json. - In Check File Presence, verify the condition uses Left Value
={{ $json.error }}and operatornotExiststo detect missing files. - In Decode File Content, keep the JavaScript that decodes base64 content to UTF-8.
- In Compare File Changes, ensure the comparison uses Left Value
={{ $json.content }}and Right Value={{ $('Iterate Workflow Items').item.json.toJsonString() }}with operatornotEquals.
Step 4: Configure Create and Update Commit Actions
Define how workflow JSON files are created or updated in GitHub based on the comparison results.
- Open Create File Commit and set Owner to
={{$node["Initialize Repo Settings"].json["repo"]["owner"]}}. - Set Repository to
={{$node["Initialize Repo Settings"].json["repo"]["name"]}}and File Path to={{$node["Initialize Repo Settings"].json["repo"]["path"]}}{{ $('Iterate Workflow Items').item.json.name }}.json. - Set File Content to
={{ $('Iterate Workflow Items').item.json.toJsonString() }}and Commit Message to=[N8N Backup] {{ $('Iterate Workflow Items').item.json.name }}.json. - Open Update File Commit and set Operation to
editwith the same File Path, File Content, and Commit Message as above. - Confirm the routing: Check File Presence → Create File Commit for missing files, and Compare File Changes → Update File Commit for changed files.
Step 5: Test and Activate Your Workflow
Validate the workflow end-to-end and enable it for scheduled backups.
- Click Execute Workflow to run a manual test from Scheduled Run Trigger.
- Verify that Fetch Workflow List returns workflows and Iterate Workflow Items processes them in sequence.
- Check GitHub: new workflows should be created via Create File Commit, and modified ones should be updated via Update File Commit.
- When successful, toggle the workflow to Active to enable scheduled backups.
Common Gotchas
- GitHub credentials can expire or need specific permissions. If things break, check your Personal Access Token scopes and the repo access in GitHub 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 repo and token are ready.
No. You’ll paste credentials and adjust a few fields in the Globals/settings step. The compare and commit logic is already built.
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 costs (usually free for this use) and any VPS cost if you self-host.
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 you’ll want to adjust the repository path logic in the repo settings step so different workflows write to different subfolders. A common approach is mapping workflow tags or naming conventions into a folder name, then writing files to /team-a/, /team-b/, and so on. You can also change the filename format if you prefer IDs over names to reduce conflicts. Just note the current limitation: if a workflow is renamed in n8n, the old filename can remain in GitHub unless you add cleanup logic.
Usually it’s an expired or under-scoped Personal Access Token. Regenerate the token, make sure it has access to the target repository, then update the credential used by each GitHub node. If it fails only sometimes, you may also be hitting rate limits when backing up a lot of workflows in one run.
A lot.
For this use case, yes, because you need looping, file retrieval, comparisons, and conditional commits, which gets awkward (and pricey) in simpler automation tools. n8n also gives you a self-hosting option, which is nice when backups are “infrastructure,” not a per-task expense. Zapier or Make can still work if you only back up a single export occasionally, but you’ll lose the clean batch processing and Git-native flow. If your team is split on tooling, test one scheduled run and review the repo output together. Talk to an automation expert if you want help choosing the simplest setup.
Once this is running, your workflows stop being fragile one-off assets and start behaving like versioned systems. Set it up, let it run, and keep your team’s changes traceable.
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.