n8n Credentials Backup to GitHub
detail.loadingPreview
Automate backing up your n8n instance credentials to a GitHub repository.
About This Workflow
This workflow is designed to automatically back up all credentials configured within an n8n instance to a specified GitHub repository. It ensures that your sensitive credential data is stored securely and versioned in GitHub, providing a reliable backup solution.
Key Features
- Automated Backups: Triggers backups automatically on a schedule (e.g., every 2 hours) or manually.
- GitHub Integration: Leverages the GitHub API to read existing credential files and create or update them.
- File Versioning: Stores credentials as individual JSON files named by their n8n credential ID within a specified folder in your GitHub repository.
- Difference Detection: Compares existing credentials with the current ones to determine if they are 'new', 'different', or 'same', and acts accordingly.
- Configurable Repository: Easily set your GitHub username, repository name, and the path within the repository where credentials should be stored via the 'Globals' node.
- Secure Storage: Backs up decrypted credentials, making them readily available for recovery.
How To Use
Setup Guide
-
Configure GitHub Credentials: In n8n, go to
Credentialsand add aGitHub APIcredential. Ensure it has the necessary permissions to read and write files in your target repository. -
Update Globals Node: Locate the
Globalsnode in the workflow. Update the following parameters:repo.owner: Your GitHub username.repo.name: The name of your GitHub repository.repo.path: The folder path within your repository where you want to store the credential files. If the folder doesn't exist, it will be created. Example:credentials/.
-
Trigger the Workflow:
- Manual Trigger: Click the 'execute' button on the
On clicking 'execute'node. - Scheduled Trigger: The
Schedule Triggernode is configured to run every 2 hours by default. You can adjust this schedule as needed.
- Manual Trigger: Click the 'execute' button on the
-
Workflow Execution:
- The workflow first executes a command-line command (
npx n8n export:credentials --all --decrypted) to get the current credentials from the n8n instance. - It then formats the output JSON.
- The
Loop Over Itemsnode processes each credential. - For each credential, the workflow attempts to get the corresponding file from GitHub using the
Get file datanode. - The
isDiffOrNewnode compares the fetched data with the current credentials. - Based on the comparison, it either does nothing (
Same file - Do nothing), updates the file in GitHub (Edit existing filefor 'different' status), or creates a new file in GitHub (Create new filefor 'new' status). - The
Returnnode signifies the completion of a branch of operations.
- The workflow first executes a command-line command (
Apps Used
Workflow JSON
{
"id": "82d8fbee-6e16-4f71-98bc-5317d2118744",
"name": "n8n Credentials Backup to GitHub",
"nodes": 21,
"category": "System Operations",
"status": "active",
"version": "1.0.0"
}Note: This is a sample preview. The full workflow JSON contains node configurations, credentials placeholders, and execution logic.
Get This Workflow
ID: 82d8fbee-6e16...
About the Author
DevOps_Master_X
Infrastructure Expert
Specializing in CI/CD pipelines, Docker, and Kubernetes automations.
Statistics
Related Workflows
Discover more workflows you might like
Universal CSV to JSON API Converter
Effortlessly transform CSV data into structured JSON with this versatile n8n workflow. Integrate it into any application as a custom API endpoint, supporting various input methods including file uploads and raw text.
Automate Local Business Outreach with AI-Powered Yelp Scraper
This workflow automates the process of scraping local business details from Yelp using AI, then leverages that data to send personalized partnership proposals via Gmail. It's perfect for sales and marketing teams looking to streamline lead generation and outreach campaigns.
Automate Getty Images Editorial Search & CMS Integration
This n8n workflow automates searching for editorial images on Getty Images, extracts key details and embed codes, and prepares them for seamless integration into your Content Management System (CMS), streamlining your content creation process.