🔓 Unlock all 10,000+ workflows & prompts free Join Newsletter →
✅ Full access unlocked — explore all 10,000 AI workflow and prompt templates Browse Templates →
Home n8n Workflow
January 22, 2026

GitHub backups that only commit real changes

Lisa Granqvist Partner Workflow Automation Expert

Your backups are “working”… but your GitHub history is a mess. Commit after commit of identical exports, noisy diffs, and zero confidence that the one commit you need will be easy to find when something breaks.

Ops leads feel it during incident cleanup. Agency owners notice it when onboarding a new client workspace. And if you’re the person who actually maintains n8n, this GitHub backup automation saves you from babysitting exports and second-guessing restores.

This workflow backs up your n8n workflows and credentials on a schedule, detects real changes using hashes, and only then commits to GitHub. You’ll see what it does, what you need, and how to avoid the usual gotchas.

How This Automation Works

The full n8n workflow, from trigger to final output:

n8n Workflow Template: GitHub backups that only commit real changes

The Problem: Backups That Create More Work

If you export n8n workflows and credentials “just in case,” you’ve probably created a new problem. Exports get dumped into a folder, then pushed to GitHub, then pushed again… even when nothing changed. That fills your repo with pointless commits, makes it harder to scan history, and turns a restore into detective work. Worse, teams stop trusting backups when the signal-to-noise ratio gets bad, so they delay maintenance until something breaks.

It adds up fast. Here’s where the friction shows up day to day.

  • Your GitHub timeline becomes unreadable because every scheduled run “looks” important.
  • Diffs are noisy, so reviewing changes turns into guesswork instead of a quick check.
  • Restores take longer because you waste time finding the last meaningful export.
  • Manual exports get skipped on busy weeks, which is exactly when changes are most likely.

The Solution: Change-Detected n8n Backups to GitHub

This workflow runs on a schedule you control, exports your n8n workflows and credentials, and then checks if the export content actually changed since the last run. It does that with a SHA-256 hash comparison, which is basically a fingerprint of the exported JSON. If the fingerprint matches the previous one, it skips the GitHub commit and moves on. If it’s different, it reads the exported file, extracts the text, and commits a timestamped backup file to your GitHub repo. The result is a clean, trustworthy history that only grows when something real happened.

The workflow starts with a Schedule Trigger, then runs two parallel backup tracks (workflows and credentials). Each track exports, generates a new hash, compares it to the prior hash, and only then pushes to GitHub. The commit message and filename include an ISO timestamp, so finding a restore point is quick.

What You Get: Automation vs. Results

Example: What This Looks Like

Say your team updates n8n a few times a week, but you run backups every day. Manually, an export + a Git commit + a quick sanity check is easily 15 minutes each run, so that’s about 2 hours a week of pure “just in case” work. With this workflow, you set the schedule once, then only spend time on the days something changed (maybe 10 minutes to glance at the commit and move on). On no-change days, you get a clean repo and zero busywork.

What You’ll Need

  • n8n instance (try n8n Cloud free)
  • Self-hosting option if you prefer (Hostinger works well)
  • GitHub for storing backups with real version history.
  • Execute Command access to run n8n export on the host.
  • GitHub token (get it from GitHub Developer Settings → Personal access tokens).

Skill level: Intermediate. You’ll connect GitHub credentials and be comfortable running n8n on a server where command execution is allowed.

Don’t want to set this up yourself? Talk to an automation expert (free 15-minute consultation).

How It Works

A scheduled run kicks everything off. The Schedule Trigger starts the automation at your chosen interval (daily, hourly, whatever fits). No manual exports. No “did anyone remember?” follow-ups.

Exports get written to known file paths. The workflow sets a workflow export path and a credential export path, then uses Execute Command to run n8n export:workflow and n8n export:credentials. Those files become the source of truth for change detection.

Hash comparison decides if anything is worth committing. A helper flow reads the file, extracts the text, and computes a SHA-256 hash. The workflow compares the “prior hash” to the “latest hash” using an If node. Same hash means same content, so it skips GitHub.

Only real changes get pushed to GitHub. When a change is detected, the workflow reads the export JSON, extracts the text, then uploads it to GitHub under a timestamped filename (plus a commit message you can recognize later). GitHub nodes continue on error so a hiccup doesn’t stop everything.

You can easily modify the schedule interval 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 the automation schedule and establish the parallel branches that build the workflow and credential backup paths.

  1. Add and open Scheduled Automation Trigger.
  2. Set the rule interval to run every hour by configuring Rule with field: hours.
  3. Confirm that Scheduled Automation Trigger outputs to both Define Workflow File Path and Define Credential File Path in parallel.
  4. Flowpast Branding as a visual reference note for the workflow canvas.

Running this trigger hourly helps ensure your backups are current without overloading the system.

Step 2: Define Backup File Paths and Export Commands

Set fixed file paths for workflow and credential exports, then run export commands to generate the source files.

  1. In Define Workflow File Path, set filePath to /data/shared/WorkFlowBackup.json.
  2. In Define Credential File Path, set filePath to /data/shared/CredentialBackup.json.
  3. In Run Workflow Export Command, set Command to =n8n export:workflow --all --output={{ $('Define Workflow File Path').item.json.filePath }}.
  4. In Run Credential Export Command, set Command to =n8n export:credentials --all --output={{ $('Define Credential File Path').item.json.filePath }}.

⚠️ Common Pitfall: The executeCommand nodes require file system permissions to write to /data/shared. Ensure your n8n instance has access to this directory.

Step 3: Set Up Hash Generation for Change Detection

Configure the internal hashing workflow that computes SHA256 values from the exported files.

  1. Open Hash Generation Trigger and confirm it expects filePath as an input value.
  2. In Read Source File, set File Selector to ={{ $json.filePath }}.
  3. In Extract File Text, set Operation to text.
  4. In Compute SHA256 Hash, set Type to SHA256, Value to ={{$json.data}}, and Data Property Name to hash.

The hash workflow is invoked by Retrieve Prior Workflow Hash, Retrieve Latest Workflow Hash, Retrieve Prior Credential Hash, and Retrieve Latest Credential Hash, so keep the input/output consistent.

Step 4: Configure Change Detection Logic

Compare the latest hashes to prior hashes and only proceed when a change is detected.

  1. In Retrieve Prior Workflow Hash and Retrieve Latest Workflow Hash, map filePath to ={{ $('Define Workflow File Path').item.json.filePath }}.
  2. In Check Workflow Change, set the condition to notEquals with Left Value ={{ $('Retrieve Latest Workflow Hash').item.json.hash }} and Right Value ={{ $('Retrieve Prior Workflow Hash').item.json.hash }}.
  3. In Retrieve Prior Credential Hash and Retrieve Latest Credential Hash, map filePath to ={{ $('Define Credential File Path').item.json.filePath }}.
  4. In Check Credential Change, set the condition to notEquals with Left Value ={{ $('Retrieve Latest Credential Hash').item.json.hash }} and Right Value ={{ $('Retrieve Prior Credential Hash').item.json.hash }}.

Only the TRUE branches from Check Workflow Change and Check Credential Change continue to file loading and Git uploads.

Step 5: Configure Backup Parsing and Git Uploads

Load the exported files, parse their content, and upload the backups to GitHub when changes are detected.

  1. In Load Workflow File, set File Selector to ={{ $('Define Workflow File Path').item.json.filePath }}.
  2. In Parse Workflow Text, set Operation to text.
  3. In Upload Workflow Backup to Git, set File Path to ={{ "backups/WorkFlow Backup " + new Date($now).toISOString().replace('T', ' ').slice(0, 16) + ".json" }}, File Content to ={{ $json.data }}, and Commit Message to ={{ "WorkFlow Backup " + new Date($now).toISOString().replace('T', ' ').slice(0, 16) }}.
  4. Credential Required: Connect your githubApi credentials in Upload Workflow Backup to Git.
  5. In Load Credential File, set File Selector to ={{ $('Define Credential File Path').item.json.filePath }}.
  6. In Parse Credential Text, set Operation to text.
  7. In Upload Credential Backup to Git, set File Path to ={{ "backups/ Credential Backup " + new Date($now).toISOString().replace('T', ' ').slice(0, 16) + ".json" }}, File Content to ={{ $json.data }}, and Commit Message to ={{ " Credential Backup " + new Date($today).toISOString().replace('T', ' ').slice(0, 16) }}.
  8. Credential Required: Connect your githubApi credentials in Upload Credential Backup to Git.

⚠️ Common Pitfall: The owner and repository fields in both GitHub nodes are set to [YOUR_ID]. Replace these with your actual GitHub owner and repository values.

Step 6: Test and Activate Your Workflow

Run a manual test to confirm hash comparisons and backup uploads, then activate the schedule.

  1. Click Execute Workflow to run the workflow manually.
  2. Verify that Check Workflow Change and Check Credential Change only pass TRUE when the hashes differ.
  3. Confirm that new files appear in GitHub from Upload Workflow Backup to Git and Upload Credential Backup to Git when changes are detected.
  4. Turn on Active to enable the hourly schedule in Scheduled Automation Trigger.
🔒

Unlock Full Step-by-Step Guide

Get the complete implementation guide + downloadable template

Common Gotchas

  • GitHub credentials can expire or need specific permissions. If things break, check your token scopes in GitHub Developer 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

How long does it take to set up this GitHub backup automation automation?

About 30 minutes if your repo and tokens are ready.

Do I need coding skills to automate GitHub backup automation?

No. You’ll mostly connect credentials and confirm file paths. The only “technical” part is allowing the export commands to run on your n8n host.

Is n8n free to use for this GitHub backup automation workflow?

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) and the server cost if you self-host.

Where can I host n8n to run this automation?

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.

Can I customize this GitHub backup automation workflow for separate repos for workflows vs. credentials?

Yes, but you’ll make the change in the GitHub upload steps, not in the hashing. Point the “Upload Workflow Backup to Git” node to one repo/path and the “Upload Credential Backup to Git” node to another. Common tweaks include changing the backup folder names, editing the commit message format, and adjusting the schedule so it runs after deployments.

Why is my GitHub connection failing in this workflow?

Usually it’s an expired or under-scoped token. Generate a fresh GitHub personal access token, then update the GitHub credentials inside n8n. If it still fails, check the repo access (private vs. public) and confirm the workflow is writing to a path your token can commit to.

How many exports can this GitHub backup automation automation handle?

A lot, because it’s basically one scheduled run that writes two files and optionally commits them.

Is this GitHub backup automation automation better than using Zapier or Make?

For this use case, yes. Zapier and Make aren’t a great fit for running local export commands, reading local files, and doing hash-based change detection without awkward workarounds. n8n can do it in one place, with branching logic that doesn’t punish you for complexity, and you can self-host so you’re not paying per tiny step. If you only need a simple “copy file to cloud storage” kind of backup, those tools can be fine. But for clean GitHub history, this pattern is hard to beat. Talk to an automation expert if you want help choosing.

Clean commits. Reliable restores. Less babysitting. Set it up once, and your n8n backups stop being another weekly chore.

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.

Lisa Granqvist

Workflow Automation Expert

Expert in workflow automation and no-code tools.

×

Use template

Get instant access to this n8n workflow Json file

💬
Launch login modal Launch register modal