n8n

How to Automate GitHub Backups for Version Control?

Keep your n8n workflows safe and easy to track by backing them up to GitHub on a set schedule. You also get clear Slack updates when a run starts, finishes, or hits a problem. This is ideal for teams that want version control, change history, and a simple recovery path.

On each run, a time trigger kicks things off and posts a start message to Slack. The flow calls the n8n API to list every workflow, then processes them in batches to use less memory. For each item, it builds a folder path by year and month, fetches any existing file from GitHub, and compares the content using a code step that orders JSON keys before diffing. A switch then chooses to create a new file, edit an existing one, or skip if nothing changed. The job can call itself to manage large sets and includes a check for oversized files. When done, it sends a completion notice to Slack.

Set a GitHub repo and a Slack webhook, then add your n8n API credentials. Expect the first full backup to take longer, with later runs finishing faster as only changes are committed. Use it for audit trails, compliance records, and quick rollback. You save hours of manual exports and reduce risk from missed updates.

What are the key features?

  • Scheduled run at a set time using a schedule trigger with daily timing.
  • Lists every workflow via the n8n API and loops through items with Split in Batches.
  • Self calls the workflow to keep memory use low during large runs.
  • Builds a year and month subfolder and uses the workflow ID as the filename.
  • Fetches existing GitHub file content with an HTTP request to compare versions.
  • Code step sorts JSON keys and detects new, different, or same files.
  • Switch node routes actions to create, edit, or skip based on status.
  • Creates or updates files in GitHub with clear commit messages.
  • Slack messages announce start, completion, and any failed items.
  • Checks for large files and handles them safely before merging data.

What are the benefits?

  • Reduce manual exports from hours to minutes
  • Automate 100 percent of daily workflow backups
  • Improve accuracy by removing manual copy paste steps
  • Handle over 1000 workflows with batch processing
  • Connect GitHub and Slack for clear change tracking
  • Keep a consistent folder structure by year and month

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 Slack. See the Tools Required section above for links to create accounts with these services.
  3. In n8n Cloud, open Settings > Personal Access Tokens and create an API token. In Credentials, create a new 'n8n API' credential and add your base URL and token.
  4. In your GitHub account, create a repository to store backups. Generate a Personal Access Token with repo scope. In n8n Credentials, create a 'GitHub' credential and enter the token.
  5. In your Slack workspace, create an Incoming Webhook or Slack app with a webhook. In n8n Credentials, create a 'Slack Webhook' credential and paste the webhook URL.
  6. Open the Config node and fill in repo_owner, repo_name, and repo_path. Use a trailing slash for the path so files save inside the folder.
  7. Review the Schedule Trigger and set the run time that fits your maintenance window.
  8. Open the Split in Batches node and adjust batch size if you have many workflows. Smaller batches reduce memory use.
  9. Click Execute to run a test. You should see a Slack start message, then completion or failure notices.
  10. Check your GitHub repo. You should see folders by year and month and files named with the workflow ID. Open a file to confirm the content and commit message show the status.
  11. Run a second test after editing one workflow in n8n. Confirm only that file is updated in GitHub and unchanged files are skipped.
  12. If Slack messages do not appear, verify the webhook URL in the Slack credential. If GitHub returns 403 or 404, confirm the token scope and repository name. If the n8n node fails, check the API token and base URL.
  13. Activate the workflow so the schedule runs every day. Monitor Slack for start and completion messages and review any failed items promptly.

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

Slack

Sign up

Free plan: $0 / mo; limited to 10 apps (third-party or custom) and usable via Slack API

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.