n8n

How to Automate GitHub Multi File Updates?

Push many files to a Git repository in one action. Great for teams that update sites, docs, or config files and want one clean commit instead of many small uploads. It cuts clicks, reduces mistakes, and keeps history tidy.

The run starts with a manual trigger. A settings step holds your token, username, repo, branch, and commit message. Two file steps prepare file paths and content, and you can add more as needed. HTTP requests then talk to the GitHub API in order. First it reads the latest commit on the branch, then pulls the base tree for that commit. Next it builds a new tree that lists all files to add or change. After that it creates a new commit and finally moves the branch to point to the new commit. Batch updates land in one commit with a clear message.

You need a GitHub Personal Access Token with content write rights. Enter your repo details in the settings step and list your file paths and content in the file steps, then align those entries in the create tree request. Run a test and confirm that the branch updates and the files appear in the right folders. Expect faster releases, fewer errors, and a simpler update routine for static sites, documentation, and configuration changes.

What are the key features?

  • Manual start gives you full control over when updates go live
  • Central settings step stores token, repo, branch, and message
  • File steps define paths and content for each file you want to add or change
  • Reads the latest branch commit to anchor changes to the right history
  • Fetches the base tree so new files are added on top of the correct state
  • Builds a new tree that batches multiple files into one request
  • Creates a commit and updates the branch to point to it

What are the benefits?

  • Reduce manual uploads from 20 minutes to 2 minutes
  • Streamline repository updates with 80 percent fewer clicks
  • Improve commit accuracy by removing most copy paste errors
  • Handle many files in a single run with one clear commit
  • Work directly with the GitHub API without extra tools

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. Create a GitHub Personal Access Token with read and write permissions for repository contents. Save the token in a safe place.
  4. Open the Set GitHub Info node and enter your GitHub username, repository name, target branch, commit message, and your token.
  5. Open the File 1 and File 2 nodes and set each file path and content. Add more Set nodes if you need more files.
  6. Open the Create new tree node and make sure each tree entry matches your file paths and content fields. Add more tree entries if you added more files.
  7. Double click each HTTP Request node. If a credential is requested, choose Create new credential, then follow the on screen steps to connect with GitHub using your token.
  8. Click Test workflow in n8n. Check the outputs of the Get latest commit SHA and Get base tree SHA steps for valid SHA values.
  9. Confirm that the Create commit step returns a new commit SHA and the Update branch step returns success.
  10. Refresh your GitHub repository page and check the target branch. Verify that the files exist in the correct folders and the commit message is correct.
  11. If you see 401 errors, confirm the token and its permissions. For 422 errors, check the branch name and file paths. For large files or many entries, reduce file size or commit in smaller batches.

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.