Use this robust n8n workflow to automatically backup all your n8n workflows to a specified GitHub repository. Ensure data safety and version control for your n8n automation projects.
Download this n8n workflow template and start using it instantly.
• n8n administrators requiring robust version control for their automation.
• Developers needing offsite, scheduled backups of their n8n workflows.
• Users looking for advanced examples of using the n8n node for instance management.
• Teams wanting to ensure their custom n8n templates are securely stored and tracked.
Maintaining reliable backups and version control for your automations is crucial. This advanced n8n workflow solves the problem of manual backup by systematically retrieving every single n8n workflow from your instance and storing it in a dedicated GitHub repository. Before pushing, the n8n automation compares the current workflow JSON structure with the existing file in GitHub. This ensures that only new or modified n8n workflows trigger a commit, keeping your repository clean and history meaningful. The entire process leverages the internal Execute Workflow n8n node to manage memory efficiently, allowing it to scale across hundreds of n8n templates without issues. This scheduled n8n trigger ensures your backups run automatically every two hours.
The overall flow of this highly efficient n8n workflow is divided into two parts: the main loop and the subworkflow processing step.
Schedule Trigger (every 2 hours) or manually.n8n n8n node connects to the API to retrieve a comprehensive list of all published and unpublished n8n workflows present on the instance.Loop Over Items node (Split In Batches) iterates through the list of retrieved n8n workflow IDs.Execute Workflow n8n node calls the current workflow itself (acting as a subworkflow handler) for each individual workflow ID, mitigating memory strain.Execute Workflow Trigger initiates the backup logic for a single n8n workflow item. The workflow retrieves crucial GitHub configuration details from the Globals node.GitHub n8n node attempts to retrieve the backup file, named by the workflow's ID, from the configured repository. If the file is too large to be retrieved directly, an If node and an HTTP Request n8n node fetch the full content.isDiffOrNew n8n node compares the fetched GitHub backup content (after Base64 decoding) with the current version of the n8n workflow. It orders the JSON keys to ensure accurate comparison, determining if the status is 'same', 'different', or 'new'.Switch n8n node routes the flow. If the status is 'different', the Edit existing file GitHub n8n node is executed. If the status is 'new', the Create new file GitHub n8n node is executed. If 'same', the process skips the GitHub action, conserving API calls. This completes the backup of one n8n workflow template.n8n node to access the list of workflows on your instance. This typically requires an API key.GitHub n8n node to read and write files to your repository. Ensure this token has repo scope permissions.Globals n8n node (a Set node) and update the following configuration values with your GitHub details:repo.owner: Your GitHub username.repo.name: The name of your backup repository (e.g., n8n-backups).repo.path: The folder path within the repository where backups should be stored (e.g., workflows/).Schedule Trigger will handle the automatic backup, making this an excellent recurring n8n template. Schedule Trigger / Manual Trigger (n8n trigger): Initiates the entire n8n workflow process. Provides flexibility for scheduled (every 2 hours) or manual execution.
n8n (n8n node): Core node used to list all workflows on the running n8n instance. Essential for gathering all available n8n templates.
Execute Workflow (n8n node): Executes the current workflow in a loop for each item, acting as a subworkflow handler to prevent memory overload when managing many n8n workflows.
Execute Workflow Trigger (n8n trigger): Serves as the entry point for the subworkflow, receiving the data for a single n8n workflow item.
Globals (Set node): Defines global configuration variables like GitHub repository owner, name, and path. Requires mandatory user configuration.
GitHub (n8n node - Get file data): Attempts to fetch the existing backup file for comparison.
If (If file too large): Flow control n8n node that checks if the GitHub API returned only a download URL instead of the file content, routing to an HTTP call if necessary.
Code (isDiffOrNew n8n node): Contains custom JavaScript logic to decode Base64 content, sort JSON keys to normalize the data, and compare the old and current n8n workflow versions, setting the crucial github_status variable.
Switch (Check Status n8n node): Directs the flow based on whether the n8n workflow is 'same', 'different', or 'new'.
GitHub (n8n node - Create new file / Edit existing file): Performs the final write operations to GitHub, either creating a new file or updating an existing backup file with the latest n8n workflow JSON.
Use this powerful n8n workflow to automatically backup all your n8n workflows to GitHub, ensuring version control and history. Features dynamic pathing and efficient difference checking.

Use this powerful n8n workflow to automatically backup all your decrypted n8n credentials to GitHub. Protect your data using this reliable n8n templates solution.

Automate robust version control for your n8n instances. This n8n workflow uses an n8n trigger to fetch all active n8n templates and back them up securely to GitHub, ensuring data integrity and easy rollback.

Build an intelligent, multi-tool HR Chatbot using n8n and Langchain. Index BambooHR policies into Supabase and enable employee lookup with a robust n8n workflow.

Use this robust n8n workflow to synchronize campaign data and images from Baserow directly to your Shopify store, updating theme snippets dynamically. Learn how to implement this powerful n8n automation.

Freelance consultant from Brazil, specializing in automations and data analysis. I work with select clients, addressing their toughest projects. For business inquiries, email me at [email protected] or message me on Telegram for a faster response.







































