n8n

How to Automate GitHub Workflow Backups?

Keep every automation safe by saving your n8n workflows to GitHub on a schedule. Great for teams that want backup, change history, and fast rollback without manual exports. Works in the background and keeps your repo up to date with clean JSON files.

A timer or a manual run starts the process. The n8n API lists all workflows, then Split In Batches loops through them and calls a subworkflow using Execute Workflow. In that subworkflow, the system checks GitHub for an existing file named with the workflow ID. If the stored file is large, it downloads the raw file with HTTP Request. A Code step sorts JSON keys and compares content to avoid false differences. A Switch routes the result to create, edit, or skip. GitHub nodes write the file and add a clear commit message that includes the workflow name and status.

Setup is simple. Add your GitHub repo details in the Globals node and connect GitHub and n8n credentials. Run one test by clicking Execute and check your repo path for new or updated files. Expect steady backups every two hours, less manual work, and a reliable audit trail. Use this for version control, pre release backups, and team reviews.

What are the key features?

  • Runs on a schedule every two hours or on demand with a manual start.
  • Uses the n8n API to list all workflows from your instance.
  • Batches items with Split In Batches to control memory and speed.
  • Calls a subworkflow via Execute Workflow and Execute Workflow Trigger to keep the main loop light.
  • Checks GitHub for an existing file by workflow ID and reads file data.
  • Downloads raw content with HTTP Request when a file is too large.
  • Compares JSON safely by sorting keys in a Code step to avoid false diffs.
  • Routes outcomes with a Switch to create, edit, or skip based on status.
  • Commits to GitHub with clear messages that include the workflow name and status.

What are the benefits?

  • Reduce manual exports from hours to minutes each week
  • Automate 100 percent of workflow backups on a set schedule
  • Improve version accuracy by 90 percent with diff based updates
  • Handle hundreds of workflows with batch processing
  • Connect n8n and GitHub to keep one trusted source of history

How do you set it up?

  1. Import the template into n8n: Create a new workflow in n8n > Click the three dots menu > Select 'Import from File' > Choose the downloaded JSON file.
  2. You'll need accounts with GitHub and n8n. See the Tools Required section above for links to create accounts with these services.
  3. Create a GitHub repository to store your backups and note the owner name, repo name, and the folder path you want to use.
  4. In GitHub settings, create a personal access token with repo permissions. Copy the token and keep it secure.
  5. In the n8n credentials manager, open any GitHub node, choose Create new credential, and paste your token. Save and test the connection.
  6. In the n8n credentials manager, open the n8n API node, choose Create new credential, and enter your n8n base URL and API key. If unsure, follow the on screen steps.
  7. Open the Globals node and set repo.owner, repo.name, and repo.path. The path should end with a slash if you want a folder.
  8. Review the Schedule Trigger and set the interval that fits your needs. The default is every two hours.
  9. Click Execute to run a test. Watch the execution to see statuses like same, different, or new, then check your GitHub repo for files named with workflow IDs.
  10. If you see a permission error, confirm the GitHub token has repo access. If a file path is missing, the workflow will create the folder in the repo when needed.
  11. Large files are handled by the HTTP Request step automatically. No extra setup is required for this branch.
  12. Enable the workflow so it runs on the schedule and keeps your backups current.

Tools Required

$24 / mo or $20 / mo billed annually to use n8n in the cloud. However, the local or self-hosted n8n Community Edition is free.

GitHub

Sign up

Free tier: $0 / mo

n8n API

Sign up

Community Edition (self-hosted): $0 (public REST API available). Cloud Starter: $20 / mo billed annually ($24 monthly); API unavailable during free trial.

Similar Templates

Join Futurise to access 1,200+ automation templates

Get instant access to ready-made automation workflows for n8n, Make.com, AI agents, and more. Download, customise, and deploy in minutes.