Back up and restore n8n Docker workflows and credentials with GitHub and SSH
Ready for 3.0Ready 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)
- Loop Over Items (Split in Batches)
n8n-nodes-base.splitInBatches - Schedule Trigger
n8n-nodes-base.scheduleTrigger - GitHub
n8n-nodes-base.github - SSH
n8n-nodes-base.ssh - Code
n8n-nodes-base.code - Split Out
n8n-nodes-base.splitOut - Convert to File
n8n-nodes-base.convertToFile - Merge
n8n-nodes-base.merge - Extract from File
n8n-nodes-base.extractFromFile - Switch
n8n-nodes-base.switch - Edit Fields (Set)
n8n-nodes-base.set - n8n Form Trigger
n8n-nodes-base.formTrigger
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.