n8n

How to Automate GitHub n8n Workflow Backups?

Keep every automation safe by copying all n8n workflows to GitHub on a schedule. Each workflow is saved as a JSON file named with its ID, so your team can track changes, recover fast, and keep history clean. Great for IT, operations, and makers who want simple version control without manual exports.

A daily schedule kicks off the run, or you can start it by hand. The n8n node lists all workflows, then a loop processes them in batches using a subworkflow to save memory. For each item, the GitHub node checks if a file exists. If the file is large, a direct download grabs the raw content. A code step sorts JSON keys and compares the current workflow with the stored file to decide if it is the same, different, or new. A switch then skips identical files or commits only new and changed ones. Files live under your chosen repo path, and commit messages include the workflow name and status.

Set your repo owner, name, and folder in the Globals node. Connect GitHub and your n8n API in credentials. Expect fewer manual backups, faster audits, and clear change history. Useful for disaster recovery, change reviews, and handoffs across teams. Turn on the schedule to run at the time you choose and watch new commits appear as your automations evolve.

What are the key features?

  • Daily schedule trigger at a set hour plus a manual start option
  • Lists all n8n workflows and loops through them in batches to manage memory
  • Checks GitHub for existing files and downloads raw content when files are large
  • Normalizes JSON keys and compares content to detect same, different, or new
  • Creates new files for new workflows or edits existing files when changes are found
  • Skips commits for identical files to keep the repo clean
  • Uses clear commit messages with workflow name and status
  • Configurable repo owner, name, and path in a single Globals node

What are the benefits?

  • Reduce manual exports from 60 minutes to 5 minutes per week with scheduled backups
  • Automate up to 95% of workflow versioning by committing only changes
  • Eliminate 90% of human errors by skipping unchanged files
  • Handle hundreds of workflows with batch processing and subworkflow calls
  • Connect n8n and GitHub to unify automation history in one place

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. In the n8n credentials manager, create a GitHub credential. Use a Personal Access Token with repo access, or choose OAuth if available. Name the credential clearly, for example GitHub Backup.
  4. In the n8n credentials manager, create an n8n API credential for your instance. Provide the base URL of your n8n and an API key or token. Name it n8n API so it is easy to find.
  5. Open the node named Globals. Set repo.owner, repo.name, and repo.path to match your GitHub setup. Make sure repo.path ends with a slash if you want a folder, for example workflows/.
  6. Open the Schedule Trigger node and choose the hour you want the backup to run. Save the workflow after changing the time.
  7. Double click the GitHub nodes Get file data, Create new file, and Edit existing file. In the Credential to connect with dropdown, select your GitHub credential. If you do not see it, click Create new credential and follow the on screen steps.
  8. Double click the n8n node that lists workflows and choose your n8n API credential. Test the node with a manual run to confirm it returns workflows.
  9. Click Execute to run a test. After it finishes, open your GitHub repo and check the configured path. You should see files named with workflow IDs and commit messages that include the workflow name and status.
  10. If you see a 401 or permission error, update your GitHub token to include repo scope. If a file is not found on the first run, that is expected and a new file will be created.
  11. Keep the subworkflow and batch loop as provided to avoid memory issues on large instances. Turn on the workflow so the schedule runs each day.

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.