Secure your automation logic by automatically backing up all your configured n8n workflow assets to a private Gitea repository. This n8n workflow ensures version control.
Download this n8n workflow template and start using it instantly.
DevOps Engineers managing mission-critical n8n instances and seeking reliable version control.
n8n Developers requiring scheduled, granular backup for every n8n workflow change.
This robust n8n workflow solves the critical operational challenge of securing automation assets through workflow backup and version control. By leveraging the internal n8n API, this automation periodically extracts every single n8n workflow, checks if changes have occurred since the last run, and commits the updated JSON definition to a dedicated Gitea repository. This provides developers and administrators with a secure, off-site record of all active n8n templates. The design uses conditional logic (If n8n node checks) and custom Base64 encoding via a Python Code n8n node to interact with the Git API seamlessly. This efficiency ensures that only changed n8n workflows trigger an update, optimizing API usage and maintaining a clean commit history for every n8n template.
Globals n8n node loads environment variables defining the Gitea repository URL, owner, and name.n8n n8n node communicates with the local n8n API to fetch the JSON definition for all existing n8n workflows.ForEach n8n node iterates over the results, ensuring each n8n workflow is processed individually for backup.GetGitea HTTP Request n8n node attempts to retrieve the corresponding file from Gitea. It is configured to handle 404 errors (file not found) gracefully.Exist If n8n node checks the response. If the file is new, the n8n workflow proceeds to the creation path. If it exists, it proceeds to the update path.Code n8n node (Base64Encode...) to convert the n8n workflow JSON into a Base64 string, as required by the Gitea API.Changed If n8n node compares the newly encoded content against the content retrieved from Gitea. If they differ, the n8n workflow is considered modified.PutGitea HTTP Request n8n node updates the existing file. If new, the PostGitea HTTP Request n8n node creates the file, completing the backup of that specific n8n workflow.Authorization and the Value to Bearer YOURACCESSTOKEN. Ensure this token has repo read/write permissions in Gitea. Assign this credential to the GetGitea, PutGitea, and PostGitea n8n node components.n8n n8n node is connected to a credential that allows it to retrieve workflow definitions from your local n8n instance.Globals Set n8n node and update the values:repo.url: Your Gitea instance URL.repo.name: The target repository name (e.g., workflows).repo.owner: The repository owner's username (e.g., n8n). Schedule Trigger: The primary n8n trigger, responsible for setting the backup frequency (currently every 45 minutes).
Globals (Set n8n node): Centralized location to define Gitea connection details used by subsequent HTTP Request n8n node operations.
n8n (n8n node): Connects to the host n8n API to retrieve JSON data for all available n8n workflow definitions.
ForEach (Split In Batches n8n node): Splits the incoming array of n8n workflows so that each is processed individually through the backup logic.
GetGitea (HTTP Request n8n node): Attempts to retrieve the existing backup file from Gitea, using onError: continueRegularOutput to detect if the n8n workflow is new.
Exist (If n8n node): Flow control logic that branches the n8n workflow execution based on whether the file exists in the repository or needs to be created.
Base64EncodeUpdate/Create (Code n8n node - Python): These custom n8n node scripts handle the crucial step of converting the JSON n8n workflow data into Base64 format for the Gitea API.
Changed (If n8n node): Performs a byte-level comparison to determine if the local n8n workflow has changed since the last backup.
PutGitea (HTTP Request n8n node): Executes the update command to commit changes to an existing n8n workflow file in the Gitea repository.
PostGitea (HTTP Request n8n node): Executes the creation command to upload a new n8n workflow file to the Gitea repository.
Use this robust n8n workflow to automatically backup Squarespace header and footer code injections to GitHub on a recurring schedule. Secure your custom code with these n8n templates.

Use this robust n8n workflow to automatically backup all your active n8n workflows to a GitHub repository, ensuring version control and disaster recovery for every n8n template.

Securely automate your Clockify data backup using this robust n8n workflow. Archive monthly time reports directly to a GitHub repository, ensuring data integrity and historical accuracy using powerful n8n templates.

Set up an automated n8n workflow backup system. This n8n templates guide shows how to save all your live n8n workflows to Google Drive every 4 hours using the n8n node and internal API, complete with backup rotation.

Hi, I’m Llewellyn van der Merwe, also known as <<ewe>>yn, pioneering tools to automate freedom!







































