Templates / Back up and restore n8n Docker workflows and credentials with GitHub and SSH

Back up and restore n8n Docker workflows and credentials with GitHub and SSH

Ready for 3.0

by Hồ Đình Huy ✓ · 125 views · created 2026-06-09 · DevOps

Ready for 3.0. This template uses no nodes that n8n 3.0 removes. No removed nodes, versions or helpers found. Static check, last run 2026-10-19.

Nodes used (12)

GitHub

What it does

Quick Overview This workflow backs up all n8n workflows and encrypted credentials from a self-hosted Docker instance to a GitHub repository on a schedule, and provides a Basic Auth–protected form to restore workflows and credentials by importing uploaded JSON backup files over SSH. How it works 1. Runs twice daily on a cron schedule to start a backup run. 2. Creates timestamped workflows and credentials folders (via placeholder files) in the target GitHub repository. 3. Connects to the Linux host over SSH and runs the n8n CLI in the Docker container to export all workflows and all encrypted credentials. 4. Commits workflows-all.json and individual <workflow name.json workflow backups to GitHub. 5. Commits credentials-all.json and individual <name<type.json encrypted credential backups to GitHub. 6. Builds and commits a combined workflows-credentials.json file containing both exports for easy restoration. 7. Accepts uploaded JSON files via a Basic Auth form, detects whether they contain workflows or credentials (single, bulk, or combined), and imports them into the target n8n Docker container over SSH. Setup 1. Create a private GitHub repository and add GitHub API credentials in n8n with permission to write files to that repository. 2. Add SSH credentials for your Linux host and ensure the SSH user can run docker exec/docker cp against the n8n container. 3. Update the Backup Configuration and Restore Configuration nodes with your GitHub owner, repository name, and the n8n Docker container name. 4. Configure Basic Auth credentials for the restore form and deploy it behind HTTPS before activating the restore path. 5. Ensure the destination n8n instance uses the same N8NENCRYPTIONKEY as the source so encrypted credentials can be restored.

View the original on n8n.io → Check your own copy

Get the weekly “what broke” email

New templates, newly broken ones, and n8n release changes. One short email a week.

Form not loading? Subscribe here.