Skip to content
NEWMarketplace and the trig8n Agent: sell what you build, and get plans and changes that are tested before you see them. See what is new

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

  1. On clicking 'execute'
  2. n8n
  3. Return
  4. Get File
  5. If file too large
  6. Merge Items
  7. isDiffOrNew
  8. Check Status
  9. Same file - Do nothing
  10. File is different
  11. File is new
  12. Create new file
  13. Edit existing file
  14. Loop Over Items

21 steps in total.

Similar automations