N8N Export to GitHub
1. What? — Definition and context
Section titled “1. What? — Definition and context”The N8N Export GitHub workflow automatically exports modified N8N workflows to a dedicated GitHub repository. It enables versioning, easy restoration, and keeps a history of changes.
Features
Section titled “Features”| Feature | Description |
|---|---|
| Incremental export | Only modified workflows are exported |
| Smart filtering | Comparison of updatedAt timestamps |
| Automatic manifest | Metadata for all workflows |
| Credential extraction | Lists used credentials (without secrets) |
| Telegram notification | Summary of created/modified files |
| Multiple triggers | Schedule, manual, or webhook |
Repository structure
Section titled “Repository structure”stacks_vps_n8n_exports/├── README.md # Auto-generated with stats├── manifest.json # Metadata + updatedAt├── credentials-manifest.json # Credentials list (without secrets)└── workflows/ ├── orchestrateur-telegram.json ├── notification-hub.json └── *.json2. Why? — Stakes and motivations
Section titled “2. Why? — Stakes and motivations”Problems solved
Section titled “Problems solved”| Problem | Without export | With export |
|---|---|---|
| Workflow loss | N8N DB corruption = everything lost | Restore from GitHub |
| No history | Cannot roll back | Full Git history |
| Team sync | Manual export by email | Shared repository |
| Documentation | Workflows not documented | Auto-generated README |
Why an incremental export?
Section titled “Why an incremental export?”| Approach | Advantage | Drawback |
|---|---|---|
| Full export | Simple | Useless commits, large diffs |
| Incremental export | Relevant commits, clean history | Filtering complexity |
3. How? — Technical implementation
Section titled “3. How? — Technical implementation”Architecture
Section titled “Architecture”Triggers
Section titled “Triggers”| Trigger | Frequency | Usage |
|---|---|---|
| Schedule | Sunday 4 AM | Weekly backup |
| Manual | On-demand | Tests and debug |
| Webhook | On-demand | Claude Code integration |
Triggering via webhook:
source /home/guillaume/stacks_vps/n8n-exports/.envcurl -s -X POST "$WEBHOOK_URL" \ -H "X-Export-Token: $X_EXPORT_TOKEN"Incremental filtering
Section titled “Incremental filtering”Filter Modified (Code):
const manifestNode = $('Get Manifest').first();let existingMap = new Map();
if (manifestNode.json.content) { const manifest = JSON.parse( Buffer.from(manifestNode.json.content, 'base64').toString('utf8') ); existingMap = new Map( manifest.workflows.map(w => [w.id, w.updatedAt]) );}
const workflows = $input.all();const modified = workflows.filter(wf => { const prevUpdatedAt = existingMap.get(wf.json.id); return !prevUpdatedAt || prevUpdatedAt !== wf.json.updatedAt;});
if (modified.length === 0) { return [{ json: { noChanges: true } }];}
return modified;Generated files
Section titled “Generated files”manifest.json:
{ "exported_at": "2026-01-20T04:00:00.000Z", "workflow_count": 25, "active_count": 18, "inactive_count": 7, "workflows": [ { "id": "abc123", "name": "Orchestrateur Telegram", "active": true, "updatedAt": "2026-01-19T15:30:00.000Z" } ]}credentials-manifest.json:
{ "exported_at": "2026-01-20T04:00:00.000Z", "credentials": [ { "id": "1", "name": "Telegram Bot", "type": "telegramApi" }, { "id": "2", "name": "GitHub PAT", "type": "gitHubApi" } ]}Telegram notification
Section titled “Telegram notification”*N8N WORKFLOWS EXPORT*
28/01/2026 04:00
*Created (1):* - new-workflow
*Updated (3):* - orchestrateur-telegram - notification-hub - manifest
Unchanged: 21
[View on GitHub](https://github.com/...)Required credentials
Section titled “Required credentials”| Credential | Type | Usage |
|---|---|---|
n8n account | n8n API | List/Get workflows |
PAT (classic) | GitHub API | Get/Create/Edit files |
Telegram Bot | Telegram API | Notifications |
4. What if? — Outlook and limits
Section titled “4. What if? — Outlook and limits”Current limits
Section titled “Current limits”| Limit | Impact | Mitigation |
|---|---|---|
| No automatic restore | Manual import in N8N | Restore script planned |
| Credentials not exported | Manually recreate after restore | Only names are saved |
| Git history only | No one-click rollback | GitHub UI for diffs |
Evolution scenarios
Section titled “Evolution scenarios”If automatic restore is needed:
- Create a restore-from-GitHub workflow
- Selection of workflow and version
- Import via the N8N API
If multiple N8N instances:
- Adapt the manifest per instance
- Bidirectional sync between instances
- Conflict handling
If workflow volume grows:
- Per-category export (active only)
- Compression of older exports
- Git retention policy
Useful commands
Section titled “Useful commands”# View recent exportsls -la n8n-exports/workflows/
# View local changescd n8n-exports && git status
# Compare with a previous versiongit diff HEAD~1 workflows/orchestrateur-telegram.json
# Restore a workflow# 1. Copy the JSON from GitHub# 2. N8N → Import workflow → Paste JSONTroubleshooting
Section titled “Troubleshooting”| Problem | Check |
|---|---|
| No export | Workflow active? Cron correct? |
| 401 GitHub | Valid PAT? Repo permissions? |
| Constant “No changes” | manifest.json corrupted? Delete and re-run |
| Duplicate files | Verify updatedAt filtering |
Related pages
Section titled “Related pages”Workflows
Section titled “Workflows”- Notification Hub — Telegram notifications
- Telegram Orchestrator — Manual trigger
Infrastructure
Section titled “Infrastructure”- N8N Queue Mode — Backend automation
References
Section titled “References”- stacks_vps_n8n_exports — Exports repository