Skip to main content

Backup workflows to git repository on Github

Workflow preview

Workflow preview
100%
Backup workflows to git repository on Github preview
Open on n8n.io

Important notice

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

1. Workflow Overview

Source code, I maintain this worflow here. Usage Guide This workflow backs up all workflows as JSON files named in t...

Best for

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

Tools used

n8n-nodes-base.github, n8n-nodes-base.set, n8n-nodes-base.n8n, n8n-nodes-base.splitinbatches, n8n-nodes-base.if, n8n-nodes-base.code, n8n-nodes-base.scheduletrigger, n8n-nodes-base.stickynote

Source and attribution

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

Original n8n.io source

1.1 Workflow description

Title
Backup workflows to git repository on Github
Workflow name
Backup workflows to git repository on Github

Source code, I maintain this worflow here.

Usage Guide

This workflow backs up all workflows as JSON files named in the [workflow_name].json format.

Steps

  1. Create GitHub Repository

    • Skip this step if using an existing repository.
  2. Add GitHub Credentials

    • In Credentials, add the GitHub credential for the repository owner.
  3. Download and Import Workflow

    • Import this workflow into n8n.
  4. Set Global Values

    • In the Globals node, set the following:
      • repo.owner: GitHub username of the repository owner.
      • repo.name: Name of the repository for backups.
      • repo.path: Path to the folder within the repository where workflows will be saved.
  5. Configure GitHub Nodes

    • Edit each GitHub node in the workflow to use the added credentials.

Workflow Logic

Each workflow run handles files based on their status:

  1. New Workflow

    • If a workflow is new, create a new file in the repository.
  2. Unchanged Workflow

    • If the workflow is unchanged, skip to the next item.
  3. Changed Workflow

    • If a workflow has changes, update the corresponding file in the repository.

Current Limitations / Needs work

  1. Name Change of Workflows
    • If a workflow is renamed or deleted in n8n, the old file remains in the repository.
  2. Deleted Workflows
    • Deleted workflows in n8n are not removed from the repository.

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 - GitHub

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

Block 2 - Globals

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

Block 3 - n8n

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

Block 4 - Loop Over Items

Type / Role
n8n-nodes-base.splitInBatches - splitInBatches
Config choices
Version 3

Block 5 - If

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

Block 6 - If1

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

Block 7 - Code

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 8 - Create new file and commit

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

Block 9 - Update file content and commit

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

Block 10 - Schedule Trigger

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

Block 11 - Sticky Note

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

Block 12 - Sticky Note1

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

Block 13 - Sticky Note2

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

Block 14 - Sticky Note3

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

Block 15 - Sticky Note4

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

Block 16 - Sticky Note5

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

Block 17 - Sticky Note6

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

3. Summary Table

Workflow Backup workflows to git repository on Github
Complexity advanced
Nodes 17
Categories DevOps
Author Shashikanth
Published 06 Nov 2024

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/2532/2532.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 Backup workflows to git repository on Github do?

Source code, I maintain this worflow here. Usage Guide This workflow backs up all workflows as JSON files named in t...

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.