Backup n8n Credentials to GitHub
This workflow primarily implements automatic backup of all credentials to a GitHub repository, with files named according to the workflow ID and saved in JSON format. It supports scheduled execution and manual triggering, and can automatically compare the differences in backup files to ensure updates only occur when changes are detected, thereby reducing storage space and redundant commits. By processing each credential data in a loop, it optimizes memory usage. This workflow provides users with secure and reliable credential management and version control, enhancing backup efficiency and reducing manual operations.

Workflow Name
Backup n8n Credentials to GitHub
Key Features and Highlights
This workflow automates the backup of all n8n instance credentials to a GitHub repository, saving each file in JSON format named by the workflow ID. It supports both scheduled execution and manual triggering. The workflow automatically compares differences between backup files to ensure updates occur only when changes are detected, effectively saving storage space and reducing redundant commits. By processing each credential entry through a sub-workflow loop, it optimizes memory usage.
Core Problems Addressed
- Automates the backup of n8n credentials to prevent credential loss risks
- Avoids redundant backups by comparing file differences and backing up only changed data
- Centralizes credential backup files for easier version control and recovery
- Minimizes manual operations, enhancing backup efficiency and security
Use Cases
- n8n users who want to regularly back up credentials to GitHub for secure credential management
- Teams collaborating on development, requiring centralized management and tracking of credential change history
- Organizations needing automated credential backups to meet compliance and audit requirements
- Backup processes that need to save storage space and avoid unnecessary repeated commits
Main Workflow Steps
- Trigger the workflow execution either on a schedule or manually
- Execute commands to export all decrypted n8n credentials
- Format and split the credential data into multiple entries
- Loop through each credential entry, reading the corresponding backup file from GitHub
- Check whether the file exists and if it exceeds size limits
- Compare the current credential data with the backup file content for differences
- Based on the difference status, decide to create a new file, edit an existing file, or skip the operation
- Commit changes to GitHub to complete the backup
Involved Systems or Services
- n8n: Automation platform used for exporting credentials and managing workflows
- GitHub: Backup storage repository managing credential JSON files
- Built-in n8n nodes: Including Execute Command, HTTP Request, Code, Switch, Merge, Schedule Trigger, Execute Workflow, etc., to implement workflow control and logic decisions
Target Audience and Value
- n8n platform administrators and operations personnel ensuring credential security and recoverability
- Automation developers aiming to enhance the automation level of credential management
- Teams working collaboratively, facilitating credential version control and change tracking
- Enterprise users requiring compliant management of credential backup processes
This workflow significantly reduces the risk of credential loss and improves backup maintenance efficiency through automated and intelligent backup management, making it an ideal solution for n8n users to maintain system security and stability.