AutomationFlowsDevOps › Daily n8n Workflow Backup to GitHub

Daily n8n Workflow Backup to GitHub

Original n8n title: Automated Daily Workflow Backup to Github

ByHugo @hugop on n8n.io

This workflow provides a robust solution for automatically backing up all your n8n workflows to a designated GitHub repository on a daily basis. By leveraging the n8n API and GitHub API, it ensures your workflows are version-controlled and securely stored, safeguarding against…

Cron / scheduled trigger★★★★☆ complexity13 nodesn8nGitHub
DevOps Trigger: Cron / scheduled Nodes: 13 Complexity: ★★★★☆ Added:
Daily n8n Workflow Backup to GitHub — n8n workflow card showing n8n, GitHub integration

This workflow corresponds to n8n.io template #4064 — we link there as the canonical source.

This workflow follows the GitHub → n8n recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "updatedAt": "2026-01-29T00:07:55.843Z",
  "createdAt": "2025-12-15T19:30:07.129Z",
  "id": "ZadnteZADpdVNgqu",
  "name": "Automated Daily Workflow Backup To GitHub",
  "active": true,
  "isArchived": false,
  "nodes": [
    {
      "parameters": {
        "rule": {
          "interval": [
            {}
          ]
        }
      },
      "id": "2aafc10f-0bb7-419f-a6b3-fa90f5f68653",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        224,
        240
      ],
      "typeVersion": 1.2
    },
    {
      "parameters": {
        "filters": {},
        "requestOptions": {}
      },
      "id": "da87b4f8-4507-456b-bfc3-3ae7d9400449",
      "name": "Retrieve workflows",
      "type": "n8n-nodes-base.n8n",
      "position": [
        704,
        240
      ],
      "typeVersion": 1,
      "credentials": {
        "n8nApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "fieldsToAggregate": {
          "fieldToAggregate": [
            {
              "fieldToAggregate": "name"
            }
          ]
        },
        "options": {}
      },
      "id": "6cd7d968-6fa0-4ab0-ac58-ceb15c8b7b4a",
      "name": "Aggregate",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        544,
        240
      ],
      "typeVersion": 1
    },
    {
      "parameters": {
        "resource": "file",
        "operation": "list",
        "owner": {
          "__rl": true,
          "value": "shawnmcrowley",
          "mode": "name"
        },
        "repository": {
          "__rl": true,
          "value": "n8n_workflows",
          "mode": "list",
          "cachedResultName": "n8n_workflows",
          "cachedResultUrl": "https://github.com/shawnmcrowley/n8n_workflows"
        },
        "filePath": "workflows/"
      },
      "id": "854f6e82-babb-474e-a138-2a6c398fd60e",
      "name": "List files from repo",
      "type": "n8n-nodes-base.github",
      "position": [
        384,
        240
      ],
      "typeVersion": 1,
      "alwaysOutputData": true,
      "credentials": {
        "githubApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "resource": "file",
        "operation": "edit",
        "owner": {
          "__rl": true,
          "value": "shawnmcrowley",
          "mode": "name"
        },
        "repository": {
          "__rl": true,
          "value": "n8n_workflows",
          "mode": "list",
          "cachedResultName": "n8n_workflows",
          "cachedResultUrl": "https://github.com/shawnmcrowley/n8n_workflows"
        },
        "filePath": "=workflows/{{ $('Retrieve workflows').item.json.name.replace(/\\s+/g, '-').toLowerCase() }}-{{ $('Retrieve workflows').item.json.tags[0].name }}.json",
        "fileContent": "={{ $('To base64').item.json.data }}",
        "commitMessage": "=Updated: {{ $('Commit date & file name').item.json.commitDate }}"
      },
      "id": "8abba016-1f34-420a-b10b-3c8e44297725",
      "name": "Update file",
      "type": "n8n-nodes-base.github",
      "position": [
        1504,
        160
      ],
      "typeVersion": 1,
      "credentials": {
        "githubApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "resource": "file",
        "owner": {
          "__rl": true,
          "value": "shawnmcrowley",
          "mode": "name"
        },
        "repository": {
          "__rl": true,
          "value": "n8n_workflows",
          "mode": "list",
          "cachedResultName": "n8n_workflows",
          "cachedResultUrl": "https://github.com/shawnmcrowley/n8n_workflows"
        },
        "filePath": "=workflows/{{ $('Retrieve workflows').item.json.name.replace(/\\s+/g, '-').toLowerCase() }}-{{ $('Retrieve workflows').item.json.tags[0].name }}.json",
        "fileContent": "={{ $('To base64').item.json.data }}",
        "commitMessage": "=Commited: {{ $node['Commit date & file name'].json.commitDate }}"
      },
      "id": "d55efcc7-5873-4c9a-b374-b7b31814905b",
      "name": "Upload file",
      "type": "n8n-nodes-base.github",
      "position": [
        1504,
        320
      ],
      "typeVersion": 1,
      "credentials": {
        "githubApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{ $('Aggregate').item.json.name }}",
              "operation": "contains",
              "value2": "={{ $('Retrieve workflows').item.json.name.replace(/\\s+/g, '-').toLowerCase() }}-{{ $('Retrieve workflows').item.json.tags[0].name }}.json"
            }
          ]
        }
      },
      "id": "09909c9f-8a68-4670-8396-65fae9be51ff",
      "name": "Check if file exists",
      "type": "n8n-nodes-base.if",
      "position": [
        1344,
        240
      ],
      "typeVersion": 1
    },
    {
      "parameters": {
        "operation": "toJson",
        "mode": "each",
        "options": {
          "format": true
        }
      },
      "id": "43990124-eac4-4c57-9da3-39053d9e5850",
      "name": "Json file",
      "type": "n8n-nodes-base.convertToFile",
      "position": [
        864,
        240
      ],
      "typeVersion": 1.1
    },
    {
      "parameters": {
        "operation": "binaryToPropery",
        "options": {}
      },
      "id": "956de457-4d05-4ea8-be7b-390861a739d4",
      "name": "To base64",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        1024,
        240
      ],
      "typeVersion": 1
    },
    {
      "parameters": {
        "content": "### Retrieve previous file names from Github",
        "height": 380,
        "width": 300,
        "color": 5
      },
      "id": "fc258985-2621-42a3-9bc6-01048a92b702",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        368,
        112
      ],
      "typeVersion": 1
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "fe4a36ef-9f04-40e3-99bd-cc517a49b440",
              "name": "commitDate",
              "type": "string",
              "value": "={{ $now.format('dd-MM-yyyy/H:mm') }}"
            },
            {
              "id": "b0fe1bcc-e79c-4a6b-b8b4-44222c8bf4e8",
              "name": "fileName",
              "type": "string",
              "value": "={{ $('Retrieve workflows').item.json.name.replace(/\\s+/g, '-').toLowerCase() }}-{{ $('Retrieve workflows').item.json.tags[0].name }}.json"
            }
          ]
        },
        "options": {}
      },
      "id": "1bfedd8f-1921-4f33-aa45-7ab612f26059",
      "name": "Commit date & file name",
      "type": "n8n-nodes-base.set",
      "position": [
        1184,
        240
      ],
      "typeVersion": 3.4
    },
    {
      "parameters": {
        "content": "### Retrieve and process workflows from n8n",
        "height": 380,
        "width": 460,
        "color": 3
      },
      "id": "2f36af66-12ca-451a-a1ca-c5a71b94b644",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        688,
        112
      ],
      "typeVersion": 1
    },
    {
      "parameters": {
        "content": "### Commit + edit/create files if needed",
        "height": 380,
        "width": 460,
        "color": 4
      },
      "id": "dc914f31-e6b5-43b0-8a4e-f9f46118fa30",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1168,
        112
      ],
      "typeVersion": 1
    },
    {
      "parameters": {
        "content": "## To Do\nAdd a Delete Function for Purged Workflows"
      },
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        352,
        -112
      ],
      "typeVersion": 1,
      "id": "05b0ae24-9ee0-4202-b1cd-dcf8ddc95113",
      "name": "Sticky Note5"
    }
  ],
  "connections": {
    "Aggregate": {
      "main": [
        [
          {
            "node": "Retrieve workflows",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Json file": {
      "main": [
        [
          {
            "node": "To base64",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "To base64": {
      "main": [
        [
          {
            "node": "Commit date & file name",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "List files from repo",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Retrieve workflows": {
      "main": [
        [
          {
            "node": "Json file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check if file exists": {
      "main": [
        [
          {
            "node": "Update file",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Upload file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "List files from repo": {
      "main": [
        [
          {
            "node": "Aggregate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Commit date & file name": {
      "main": [
        [
          {
            "node": "Check if file exists",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update file": {
      "main": [
        []
      ]
    },
    "Upload file": {
      "main": [
        []
      ]
    }
  },
  "settings": {
    "executionOrder": "v1",
    "timeSavedMode": "fixed",
    "callerPolicy": "workflowsFromSameOwner",
    "availableInMCP": false,
    "errorWorkflow": "muXPMz9FAT3fMK6g"
  },
  "staticData": {
    "node:Schedule Trigger": {
      "recurrenceRules": []
    }
  },
  "meta": {
    "templateId": "4064",
    "templateCredsSetupCompleted": true
  },
  "versionId": "9ddacb2c-8477-405c-b30b-023237b480ad",
  "activeVersionId": "9ddacb2c-8477-405c-b30b-023237b480ad",
  "triggerCount": 1,
  "shared": [
    {
      "updatedAt": "2025-12-15T19:30:07.129Z",
      "createdAt": "2025-12-15T19:30:07.129Z",
      "role": "workflow:owner",
      "workflowId": "ZadnteZADpdVNgqu",
      "projectId": "aRJv9cLftn98cx8V"
    }
  ],
  "activeVersion": {
    "updatedAt": "2026-01-29T00:07:42.925Z",
    "createdAt": "2026-01-05T16:18:43.645Z",
    "versionId": "9ddacb2c-8477-405c-b30b-023237b480ad",
    "workflowId": "ZadnteZADpdVNgqu",
    "nodes": [
      {
        "parameters": {
          "rule": {
            "interval": [
              {}
            ]
          }
        },
        "id": "2aafc10f-0bb7-419f-a6b3-fa90f5f68653",
        "name": "Schedule Trigger",
        "type": "n8n-nodes-base.scheduleTrigger",
        "position": [
          224,
          240
        ],
        "typeVersion": 1.2
      },
      {
        "parameters": {
          "filters": {},
          "requestOptions": {}
        },
        "id": "da87b4f8-4507-456b-bfc3-3ae7d9400449",
        "name": "Retrieve workflows",
        "type": "n8n-nodes-base.n8n",
        "position": [
          704,
          240
        ],
        "typeVersion": 1,
        "credentials": {
          "n8nApi": {
            "id": "xfUhXCvp96eUoeEy",
            "name": "n8n account"
          }
        }
      },
      {
        "parameters": {
          "fieldsToAggregate": {
            "fieldToAggregate": [
              {
                "fieldToAggregate": "name"
              }
            ]
          },
          "options": {}
        },
        "id": "6cd7d968-6fa0-4ab0-ac58-ceb15c8b7b4a",
        "name": "Aggregate",
        "type": "n8n-nodes-base.aggregate",
        "position": [
          544,
          240
        ],
        "typeVersion": 1
      },
      {
        "parameters": {
          "resource": "file",
          "operation": "list",
          "owner": {
            "__rl": true,
            "value": "shawnmcrowley",
            "mode": "name"
          },
          "repository": {
            "__rl": true,
            "value": "n8n_workflows",
            "mode": "list",
            "cachedResultName": "n8n_workflows",
            "cachedResultUrl": "https://github.com/shawnmcrowley/n8n_workflows"
          },
          "filePath": "workflows/"
        },
        "id": "854f6e82-babb-474e-a138-2a6c398fd60e",
        "name": "List files from repo",
        "type": "n8n-nodes-base.github",
        "position": [
          384,
          240
        ],
        "webhookId": "354d699e-44b0-4444-9d31-af7fd4ff5561",
        "typeVersion": 1,
        "alwaysOutputData": true,
        "credentials": {
          "githubApi": {
            "id": "ua9ux59KlWVZ4tU7",
            "name": "GitHub account"
          }
        }
      },
      {
        "parameters": {
          "resource": "file",
          "operation": "edit",
          "owner": {
            "__rl": true,
            "value": "shawnmcrowley",
            "mode": "name"
          },
          "repository": {
            "__rl": true,
            "value": "n8n_workflows",
            "mode": "list",
            "cachedResultName": "n8n_workflows",
            "cachedResultUrl": "https://github.com/shawnmcrowley/n8n_workflows"
          },
          "filePath": "=workflows/{{ $('Retrieve workflows').item.json.name.replace(/\\s+/g, '-').toLowerCase() }}-{{ $('Retrieve workflows').item.json.tags[0].name }}.json",
          "fileContent": "={{ $('To base64').item.json.data }}",
          "commitMessage": "=Updated: {{ $('Commit date & file name').item.json.commitDate }}"
        },
        "id": "8abba016-1f34-420a-b10b-3c8e44297725",
        "name": "Update file",
        "type": "n8n-nodes-base.github",
        "position": [
          1504,
          160
        ],
        "webhookId": "27218087-8df7-474d-a39f-70cfa9c34ec8",
        "typeVersion": 1,
        "credentials": {
          "githubApi": {
            "id": "ua9ux59KlWVZ4tU7",
            "name": "GitHub account"
          }
        }
      },
      {
        "parameters": {
          "resource": "file",
          "owner": {
            "__rl": true,
            "value": "shawnmcrowley",
            "mode": "name"
          },
          "repository": {
            "__rl": true,
            "value": "n8n_workflows",
            "mode": "list",
            "cachedResultName": "n8n_workflows",
            "cachedResultUrl": "https://github.com/shawnmcrowley/n8n_workflows"
          },
          "filePath": "=workflows/{{ $('Retrieve workflows').item.json.name.replace(/\\s+/g, '-').toLowerCase() }}-{{ $('Retrieve workflows').item.json.tags[0].name }}.json",
          "fileContent": "={{ $('To base64').item.json.data }}",
          "commitMessage": "=Commited: {{ $node['Commit date & file name'].json.commitDate }}"
        },
        "id": "d55efcc7-5873-4c9a-b374-b7b31814905b",
        "name": "Upload file",
        "type": "n8n-nodes-base.github",
        "position": [
          1504,
          320
        ],
        "webhookId": "ce4b561b-acb9-4cd8-b76f-4928dada9674",
        "typeVersion": 1,
        "credentials": {
          "githubApi": {
            "id": "ua9ux59KlWVZ4tU7",
            "name": "GitHub account"
          }
        }
      },
      {
        "parameters": {
          "conditions": {
            "string": [
              {
                "value1": "={{ $('Aggregate').item.json.name }}",
                "operation": "contains",
                "value2": "={{ $('Retrieve workflows').item.json.name.replace(/\\s+/g, '-').toLowerCase() }}-{{ $('Retrieve workflows').item.json.tags[0].name }}.json"
              }
            ]
          }
        },
        "id": "09909c9f-8a68-4670-8396-65fae9be51ff",
        "name": "Check if file exists",
        "type": "n8n-nodes-base.if",
        "position": [
          1344,
          240
        ],
        "typeVersion": 1
      },
      {
        "parameters": {
          "operation": "toJson",
          "mode": "each",
          "options": {
            "format": true
          }
        },
        "id": "43990124-eac4-4c57-9da3-39053d9e5850",
        "name": "Json file",
        "type": "n8n-nodes-base.convertToFile",
        "position": [
          864,
          240
        ],
        "typeVersion": 1.1
      },
      {
        "parameters": {
          "operation": "binaryToPropery",
          "options": {}
        },
        "id": "956de457-4d05-4ea8-be7b-390861a739d4",
        "name": "To base64",
        "type": "n8n-nodes-base.extractFromFile",
        "position": [
          1024,
          240
        ],
        "typeVersion": 1
      },
      {
        "parameters": {
          "content": "### Retrieve previous file names from Github",
          "height": 380,
          "width": 300,
          "color": 5
        },
        "id": "fc258985-2621-42a3-9bc6-01048a92b702",
        "name": "Sticky Note1",
        "type": "n8n-nodes-base.stickyNote",
        "position": [
          368,
          112
        ],
        "typeVersion": 1
      },
      {
        "parameters": {
          "assignments": {
            "assignments": [
              {
                "id": "fe4a36ef-9f04-40e3-99bd-cc517a49b440",
                "name": "commitDate",
                "type": "string",
                "value": "={{ $now.format('dd-MM-yyyy/H:mm') }}"
              },
              {
                "id": "b0fe1bcc-e79c-4a6b-b8b4-44222c8bf4e8",
                "name": "fileName",
                "type": "string",
                "value": "={{ $('Retrieve workflows').item.json.name.replace(/\\s+/g, '-').toLowerCase() }}-{{ $('Retrieve workflows').item.json.tags[0].name }}.json"
              }
            ]
          },
          "options": {}
        },
        "id": "1bfedd8f-1921-4f33-aa45-7ab612f26059",
        "name": "Commit date & file name",
        "type": "n8n-nodes-base.set",
        "position": [
          1184,
          240
        ],
        "typeVersion": 3.4
      },
      {
        "parameters": {
          "content": "### Retrieve and process workflows from n8n",
          "height": 380,
          "width": 460,
          "color": 3
        },
        "id": "2f36af66-12ca-451a-a1ca-c5a71b94b644",
        "name": "Sticky Note2",
        "type": "n8n-nodes-base.stickyNote",
        "position": [
          688,
          112
        ],
        "typeVersion": 1
      },
      {
        "parameters": {
          "content": "### Commit + edit/create files if needed",
          "height": 380,
          "width": 460,
          "color": 4
        },
        "id": "dc914f31-e6b5-43b0-8a4e-f9f46118fa30",
        "name": "Sticky Note3",
        "type": "n8n-nodes-base.stickyNote",
        "position": [
          1168,
          112
        ],
        "typeVersion": 1
      },
      {
        "parameters": {
          "content": "## To Do\nAdd a Delete Function for Purged Workflows"
        },
        "type": "n8n-nodes-base.stickyNote",
        "position": [
          352,
          -112
        ],
        "typeVersion": 1,
        "id": "05b0ae24-9ee0-4202-b1cd-dcf8ddc95113",
        "name": "Sticky Note5"
      }
    ],
    "connections": {
      "Aggregate": {
        "main": [
          [
            {
              "node": "Retrieve workflows",
              "type": "main",
              "index": 0
            }
          ]
        ]
      },
      "Json file": {
        "main": [
          [
            {
              "node": "To base64",
              "type": "main",
              "index": 0
            }
          ]
        ]
      },
      "To base64": {
        "main": [
          [
            {
              "node": "Commit date & file name",
              "type": "main",
              "index": 0
            }
          ]
        ]
      },
      "Schedule Trigger": {
        "main": [
          [
            {
              "node": "List files from repo",
              "type": "main",
              "index": 0
            }
          ]
        ]
      },
      "Retrieve workflows": {
        "main": [
          [
            {
              "node": "Json file",
              "type": "main",
              "index": 0
            }
          ]
        ]
      },
      "Check if file exists": {
        "main": [
          [
            {
              "node": "Update file",
              "type": "main",
              "index": 0
            }
          ],
          [
            {
              "node": "Upload file",
              "type": "main",
              "index": 0
            }
          ]
        ]
      },
      "List files from repo": {
        "main": [
          [
            {
              "node": "Aggregate",
              "type": "main",
              "index": 0
            }
          ]
        ]
      },
      "Commit date & file name": {
        "main": [
          [
            {
              "node": "Check if file exists",
              "type": "main",
              "index": 0
            }
          ]
        ]
      },
      "Update file": {
        "main": [
          []
        ]
      },
      "Upload file": {
        "main": [
          []
        ]
      }
    },
    "authors": "Shawn Crowley",
    "name": "v1",
    "description": "Back Up Runs Daily at Midnight",
    "autosaved": false
  },
  "tags": []
}
Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

This workflow provides a robust solution for automatically backing up all your n8n workflows to a designated GitHub repository on a daily basis. By leveraging the n8n API and GitHub API, it ensures your workflows are version-controlled and securely stored, safeguarding against…

Source: https://n8n.io/workflows/4064/ — original creator credit. Request a take-down →

More DevOps workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

DevOps

Who is this for? This template is ideal for n8n administrators, automation engineers, and DevOps teams who want to maintain bidirectional synchronization between their n8n workflows and GitHub reposit

n8n, GitHub
DevOps

Automatically back up and sync your n8n workflows to GitHub with unlimited version control. This workflow ensures your repository always reflects the latest state of your n8n instance by creating, upd

GitHub, n8n
DevOps

github_fluxo. Uses moveBinaryData, n8n, github. Scheduled trigger; 19 nodes.

Move Binary Data, n8n, GitHub
DevOps

[Gus] Backup workflows in github. Uses github, itemLists, n8n, moveBinaryData. Scheduled trigger; 18 nodes.

GitHub, Item Lists, n8n +1
DevOps

Backup workflows to git repository. Uses github, n8n, splitInBatches, scheduleTrigger. Scheduled trigger; 17 nodes.

GitHub, n8n