Skip to main content

Automatic workflow & credentials backup to GitHub with change detection

Workflow preview

Workflow preview
100%
Automatic workflow & credentials backup to GitHub with change detection preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

This n8n workflow template uses community nodes and is only compatible with the self hosted version of n8n. Title: n8n Credentials and Workflows Backup on Change Detection Purpose: Never lose track...

Best for

  • DevOps automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.scheduletrigger, n8n-nodes-base.executeworkflow, n8n-nodes-base.readwritefile, n8n-nodes-base.set, n8n-nodes-base.executecommand, n8n-nodes-base.extractfromfile, n8n-nodes-base.crypto, n8n-nodes-base.executeworkflowtrigger

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Hamed Nickmehr.

Original n8n.io source

1.1 Workflow description

Title
Automatic workflow & credentials backup to GitHub with change detection
Workflow name
Automatic workflow & credentials backup to GitHub with change detection

This n8n workflow template uses community nodes and is only compatible with the self-hosted version of n8n.

Title: n8n Credentials and Workflows Backup on Change Detection

Purpose: Never lose track of your n8n changes again! This workflow smartly backs up all your workflows and credentials, automatically detects any changes using hash comparison, and pushes updates to GitHub—but only when something has actually changed. Set your own interval and stop cluttering your repo with redundant commits.

Walkthrough Video on YouTube


Trigger:

  • Schedule Trigger: Executes the entire process at a user-defined interval. No need to worry about traceability or managing countless backups, as the workflow only commits changes when a difference is detected.


Workflow Backup Process:

  1. Set Workflow Path: Defines the local backup file path for workflows.

  2. Get Old Workflow Hash: Executes a helper workflow to retrieve the previous hash.

  3. Execute Workflow Backup: Runs n8n export:workflow to export all workflows to the defined file path.

  4. Get New Workflow Hash: Executes a helper workflow to generate the new hash from the exported file.

  5. Compare Hashes (If Workflow Updated): Checks if the new hash differs from the old one.

  6. If Updated:

    • Read Workflow DataExtract TextPush to GitHub: Reads, extracts, and commits the updated workflow JSON to GitHub under a timestamped filename.

Credential Backup Process:

  1. Set Credential Path: Defines the local backup file path for credentials.

  2. Get Old Credential Hash: Executes a helper workflow to retrieve the previous hash.

  3. Execute Credential Backup: Runs n8n export:credentials to export all credentials.

  4. Get New Credential Hash: Executes a helper workflow to generate the new hash from the exported file.

  5. Compare Hashes (If Credential Updated): Checks for changes.

  6. If Updated:

    • Read Credential DataExtract TextPush to GitHub: Commits the new credentials JSON to GitHub if changes are found.

Hash Generator (Helper Flow): Used in both workflow and credential backup paths:

  • Read FileExtract TextHash Data
  • Outputs SHA-256 hash used for comparison

GitHub Integration:

  • Commits are created with ISO timestamp in the filename and message.
  • Repository: https://github.com/your-github-name/n8n-onchange-bachup
  • File paths: backups/WorkFlow Backup -timestamp-.json and backups/Credential Backup -timestamp-.json

Change Detection Logic:

  • Only commits files when hash changes are detected (i.e., actual content change).
  • Avoids unnecessary GitHub commits and storage use.

Error Handling:

  • GitHub nodes are set to continue workflow execution on error, avoiding full process interruption.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Schedule Trigger

Type / Role
n8n-nodes-base.scheduleTrigger - scheduleTrigger
Config choices
Version 1.2

Block 2 - Get New Workflow Hash

Type / Role
n8n-nodes-base.executeWorkflow - executeWorkflow
Config choices
Version 1.2

Block 3 - Get Old Workflow Hash

Type / Role
n8n-nodes-base.executeWorkflow - executeWorkflow
Config choices
Version 1.2

Block 4 - Read Workflow Data

Type / Role
n8n-nodes-base.readWriteFile - readWriteFile
Config choices
Version 1

Block 5 - Set Workflow Path

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 6 - Execute Workflow Backup

Type / Role
n8n-nodes-base.executeCommand - executeCommand
Config choices
Version 1

Block 7 - Read File

Type / Role
n8n-nodes-base.readWriteFile - readWriteFile
Config choices
Version 1

Block 8 - Extract Data

Type / Role
n8n-nodes-base.extractFromFile - extractFromFile
Config choices
Version 1

Block 9 - Hash Data

Type / Role
n8n-nodes-base.crypto - crypto
Config choices
Version 1

Block 10 - Hash Maker

Type / Role
n8n-nodes-base.executeWorkflowTrigger - executeWorkflowTrigger
Config choices
Version 1.1

Block 11 - Extract Workflow Data

Type / Role
n8n-nodes-base.extractFromFile - extractFromFile
Config choices
Version 1

Block 12 - GitHub Workflow Backup

Type / Role
n8n-nodes-base.github - github
Config choices
Version 1.1

Block 13 - Get New Credential Hash

Type / Role
n8n-nodes-base.executeWorkflow - executeWorkflow
Config choices
Version 1.2

Block 14 - Get Old Credential Hash

Type / Role
n8n-nodes-base.executeWorkflow - executeWorkflow
Config choices
Version 1.2

Block 15 - Read Credential Data

Type / Role
n8n-nodes-base.readWriteFile - readWriteFile
Config choices
Version 1

Block 16 - Set Credential Path

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 17 - Execute Credential Backup

Type / Role
n8n-nodes-base.executeCommand - executeCommand
Config choices
Version 1

Block 18 - Extract Credential Data

Type / Role
n8n-nodes-base.extractFromFile - extractFromFile
Config choices
Version 1

Block 19 - GitHub Credential Backup

Type / Role
n8n-nodes-base.github - github
Config choices
Version 1.1

Block 20 - If Workflow Updated

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.2

Block 21 - If Credential Updated

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.2

3. Summary Table

Workflow Automatic workflow & credentials backup to GitHub with change detection
Complexity advanced
Nodes 21
Categories DevOps
Author Hamed Nickmehr
Published 02 Jun 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/4609/4609.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Automatic workflow & credentials backup to GitHub with change detection do?

This n8n workflow template uses community nodes and is only compatible with the self hosted version of n8n. Title: n8n Credentials and Workflows Backup on Change Detection Purpose: Never lose track...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your DevOps use case.