n8n

How to Automate Git n8n Backup Versioning?

Keep your n8n work safe with automatic Git backups. The system saves all workflows and credentials to a Git repository and pushes changes on a set schedule or on demand. It is great for teams that need clear history and fast recovery.

Two triggers kick things off. A schedule runs at midnight, 6 am, noon, and 6 pm, and there is also a manual start button when you want an instant backup. The flow first exports all workflows to a folder named repo/workflows. It then exports all credentials to repo/credentials. Next it stages the files, creates a commit with a timestamp in the message, and pushes to your remote repository. Everything runs with simple command steps, so you get a clean version trail without extra apps.

You need an environment where command execution is allowed, Git is installed, and a repository path is available on the server. Expect daily backups with no human steps, an audit trail for each change, and easier rollback when something breaks. This is well suited for IT teams, agencies, and anyone who must track changes and meet audit rules while running n8n in production.

What are the key features?

  • Runs on a schedule at midnight, 6 am, noon, and 6 pm using a Cron trigger.
  • One click manual start lets you capture a backup anytime.
  • Exports all n8n workflows to repo/workflows with the n8n export command and backup flag.
  • Exports all n8n credentials to repo/credentials for safe, encrypted storage tied to your instance key.
  • Stages, commits with an ISO timestamp message, and pushes changes to your Git remote.
  • Repository path is set with git -C repo so you can point to a specific folder.

What are the benefits?

  • Reduce manual backup work from 30 minutes a day to zero
  • Automate 100 percent of export and commit steps four times per day
  • Improve recovery time from hours to minutes with clear version history
  • Cut the risk of lost changes by 90 percent through regular commits
  • Keep workflows and credentials in one secure repository for easy restore

How do you set it up?

  1. Import the template into n8n: Create a new workflow in n8n > Click the three dots menu > Select 'Import from File' > Choose the downloaded JSON file.
  2. Use an environment where the Execute Command node is allowed. Install Git, Node.js, and the n8n CLI on the same host that runs n8n.
  3. Create a local Git repository folder that the server can access. For example, make a folder named repo and initialize it, then set the remote origin to your Git provider.
  4. Set up Git authentication so pushes do not prompt for a password. Use SSH keys or an HTTPS token and confirm you can push from the server without prompts.
  5. Open the Export Workflows and Export Credentials nodes. Confirm the output paths repo/workflows and repo/credentials exist or adjust them to your preferred folder.
  6. Open the git add, git commit, and git push nodes. If your repository path differs, change the -C repo part to match your folder location.
  7. Check the Cron node schedule. Update the hours if you want a different run time or frequency.
  8. Start a manual run. After it finishes, open your Git repository and confirm new folders, files, and a commit with the current timestamp.
  9. If Git push fails, verify remote URL, network access, and credentials. If command not found errors appear, add the correct paths to Git and n8n in your system PATH.
  10. Keep your n8n encryption key safe. Credentials exports are tied to your instance key, so store the key securely for future restores.

Tools Required

$24 / mo or $20 / mo billed annually to use n8n in the cloud. However, the local or self-hosted n8n Community Edition is free.

Similar Templates

Join Futurise to access 1,200+ automation templates

Get instant access to ready-made automation workflows for n8n, Make.com, AI agents, and more. Download, customise, and deploy in minutes.