Credential Backup Restoration from Git Repository - n8n Workflow

Restore all your critical n8n credentials automatically from a GitHub backup repository. This n8n workflow template uses core n8n nodes for rapid DevOps recovery.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

Markdown-formatted:
DevOps Engineers and System Administrators managing self-hosted n8n instances.
Users who need a reliable, automated disaster recovery plan for n8n credentials.


  • Anyone utilizing GitHub for secure configuration and data backups.

Overview

Maintaining system integrity is crucial, especially when dealing with production-ready n8n workflows that rely heavily on third-party service credentials. This essential n8n workflow solves the critical problem of credential loss or migration by providing an automated restoration mechanism directly from a GitHub backup. This n8n template ensures minimal downtime and high operational security. Instead of manually re-entering dozens of API keys and authentication secrets, this n8n node sequence fetches credential JSON files stored in GitHub, processes them, and uses the internal n8n API to re-insert them into your system. It starts with an easy-to-use n8n trigger, making recovery immediate and predictable. This process is vital for robust n8n self-hosting environments.

How it Works

Markdown-formatted:


  1. Trigger and Configuration: The n8n workflow is initiated by a manual n8n trigger (Run Once/Test Workflow). The subsequent Globals n8n node defines the necessary GitHub configuration variables: repo.owner, repo.name, and repo.path where the credential backups reside.

  2. GitHub File Listing: The Get all files in given path n8n node executes an HTTP Request against the GitHub API, listing all files (potential credential JSONs) in the specified backup folder.

  3. Item Splitting: The list of files is passed to the Split the result n8n node, which splits the array into individual items, ensuring the core logic flows through one credential at a time.

  4. Content Retrieval: The Get file content from GitHub n8n node fetches the raw content for each file using its path, leveraging a dedicated GitHub API credential.

  5. JSON Conversion: The Convert files to JSON n8n node uses the Extract From File functionality to decode and convert the raw file content (which is expected to be a stringified JSON representation of an n8n credential) into a structured JSON object.

  6. Credential Check: The Check for skipped Credentials n8n node (an If node) applies conditional logic to skip invalid items (e.g., empty files or the special 'n8n account' credential which typically cannot be restored via this method). Only valid credential data proceeds.

  7. Restoration: Finally, the Restore n8n Credentials n8n node, acting as the ultimate action node, uses the internal n8n API to perform a 'Create or Update' operation on the credential resource, restoring the name, type, and data for the backed-up service. This completes the essential step of this powerful n8n workflow.

Installation Guide

Markdown-formatted:


  1. Import the n8n Workflow: Copy the provided JSON data and import it directly into your n8n instance via the Workflows section.

  2. Set GitHub Credentials: You must configure a GitHub API credential to allow the workflow to read files from your repository.

  3. Set n8n API Credentials: You must configure an n8n account credential that allows the workflow to interact with your local n8n instance's API to manage credentials.

  4. Configure Globals Node: Open the Globals n8n node and update the following values to match your backup setup:

repo.owner: Your GitHub username.
repo.name: The name of your backup repository.
* repo.path: The directory path within the repository where credential files are stored (e.g., credentials/).

  1. Test and Activate: Execute the n8n workflow using the manual n8n trigger to test connectivity and successful credential restoration.

Node Details

Markdown-formatted:
When clicking ‘Test workflow’ (Manual Trigger): The starting n8n trigger for the entire restoration process. Since this is an administrative task, a manual n8n trigger is appropriate.
Globals (Set n8n node): Essential for defining environment variables, specifically the GitHub repository owner, name, and the exact path (repo.path) to the credential backup files.
Get all files in given path (HTTP Request n8n node): Performs a GET request to the GitHub Content API using dynamic expressions based on the variables set in the Globals node, retrieving a list of all files to be restored.
Split the result (SplitOut n8n node): Crucial flow control n8n node. It processes the array of files returned by GitHub, ensuring each subsequent step operates on a single credential file's metadata.
Get file content from GitHub (GitHub n8n node): Fetches the actual content of the credential file based on the dynamic path received from the previous n8n node. Operation is set to 'Get File'.
Convert files to JSON (Extract From File n8n node): Decodes the file content (which is typically base64 encoded by GitHub) and converts the resulting string into a usable JSON object structure required for the n8n API.
Check for skipped Credentials (If n8n node): Implements conditional flow control. It filters out empty files ($json.data is empty) or items explicitly named 'n8n account', which prevents errors during the final restoration step.
Restore n8n Credentials (n8n n8n node): The final action. This n8n node uses the local n8n API (/api/v1/credentials) to update or create the credential resource, dynamically setting the name, credentialTypeName, and data from the extracted file content. This node executes the core purpose of this n8n workflow.

Related n8n Workflows

Free

Nodes: 9 Nodes
Updated: December 26 2025
View all
Created by

Automation specialist with 10+ years of experience helping SME website owners streamline their workflows—specializing in Squarespace, Shopify, and WordPress. Book an initial consultation for custom n8n automation using my link.

Featured*