Library / Code, Git & Developer Tools
Code, Git & Developer Tools
Back Up n8n Workflows to GitHub in Subfolders
On a schedule or manual run, all workflows on the n8n instance are read through the API and new or changed ones are committed to GitHub.
What it does
## Backup to GitHub This workflow will backup all instance workflows to GitHub. The files are saved ID.json for the filename. ### Setup Open Globals node and update the values below 👇 - repo.owner: your Github username - repo.name: the name of your repository - repo.path: the folder to use within the repository. If it doesn't exist it will be created. If your username was john-doe and your repository was called n8n-backups and you wanted the workflows to go into a workflows folder you would set: - repo.owner - john-doe - repo.name - n8n-backups - repo.path - workflows/ The workflow calls itself using a subworkflow, to help reduce memory usage.
The steps
- On clicking 'execute'
- n8n
- Return
- Get File
- If file too large
- Merge Items
- isDiffOrNew
- Check Status
- Same file - Do nothing
- File is different
- File is new
- Create new file
- Edit existing file
- Loop Over Items
21 steps in total.
Similar automations
Code, Git & Developer ToolsBack Up n8n Workflows to GitHub via Pull Requests22 stepsCode, Git & Developer ToolsRestore n8n Workflows from GitHub13 stepsCode, Git & Developer ToolsRestore n8n Workflows from GitHub, Skipping Existing Ones12 stepsCode, Git & Developer ToolsRestore n8n Workflows from Merged GitHub Pull Requests13 steps