n8n

How to Automate GitHub Credential Backups?

Back up your platform credentials to GitHub on a set schedule. The flow checks each record, writes only new or changed files, and keeps a clean history in your repo. Built for IT teams that want simple, trackable backups without manual work.

It can run every two hours or on demand. A command exports all credentials, a formatter cleans the JSON, and a batch loop processes items one by one using a subworkflow to keep memory use low. For each credential, the system pulls the current file from GitHub. If the file is large, it downloads it via the direct link, then a code step compares sorted JSON to decide same, different, or new. A switch then creates a new file or edits an existing one with a clear commit message. If nothing changed, it skips the write to save time and API calls. Files use the credential id as ID.json inside your chosen repo path.

Set the repo owner, name, and folder once in the Globals node. Expect faster runs, fewer errors, and an easy audit trail of changes over time. Teams that manage many secrets or need a quick way to restore after mistakes will see value right away. You can also run it manually when needed and adjust the schedule to fit your policy.

What are the key features?

  • Scheduled runs every two hours with an option to run manually
  • Exports credentials via a command step and formats clean JSON
  • Batch processing with Split In Batches and a subworkflow to reduce memory
  • Fetches current file data from GitHub and handles large files via direct download
  • Compares sorted JSON to detect same, different, or new status
  • Creates new files or edits existing files in GitHub with clear commit messages
  • Skips writes when nothing changed to reduce API calls
  • Configurable repo owner, repo name, and path in a Globals node
  • Stores each credential as ID.json in the chosen folder

What are the benefits?

  • Reduce manual backup work from hours each week to a few minutes
  • Automate 100 percent of credential backup checks on a set schedule
  • Improve backup accuracy by removing copy paste errors
  • Create a clear audit trail with commit messages for each change
  • Connect your system with GitHub for versioned, searchable storage
  • Scale to many credentials using batching and a subworkflow loop

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. You'll need accounts with GitHub. See the Tools Required section above for links to create accounts with these services.
  3. In GitHub, create or choose a repository where backups will be stored. Ensure your user or token has permission to read and write repository contents.
  4. In n8n, open the workflow and double click any GitHub node. In the 'Credential to connect with' dropdown, click 'Create new credential' and follow the on screen instructions to integrate GitHub.
  5. If using a personal access token, generate it in your GitHub account with repo scope. Save it securely and use it when creating the credential in n8n Cloud.
  6. Open the node named Globals. Set repo.owner to your GitHub username, repo.name to your repository name, and repo.path to the folder where files should be stored. Include a trailing slash for the folder.
  7. Review the Schedule Trigger node. The default is every two hours. Adjust the interval to match your backup policy if needed.
  8. Confirm the Execute Command and JSON formatting steps work in your environment. If Execute Command is restricted, run a manual test and check the output items before proceeding.
  9. Click Execute Workflow to run a test. Watch the run to see statuses marked as same, different, or new. Ensure at least one file is created or updated.
  10. In GitHub, open the target repository and folder. Verify new ID.json files exist and that commit messages show the credential name and status.
  11. If you see 403 errors, check that your GitHub credential has the correct scopes. If you see 404 on read, that is normal for new files and will route to file creation.
  12. When satisfied, activate the workflow so scheduled backups run automatically.

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.

GitHub

Sign up

Free tier: $0 / mo

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.