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.