Push Multiple Files to GitHub Repo via GitHub REST API
This workflow enables the bulk upload of multiple files to a specified GitHub repository via the GitHub REST API, addressing the limitations of single file uploads. Users only need to configure the relevant information to automatically retrieve the latest commits, create a file tree, and submit updates, enhancing the efficiency and flexibility of file management. It is suitable for developers and content managers, particularly excelling in scenarios involving automated continuous integration and multi-file synchronization.

Workflow Name
Push Multiple Files to GitHub Repo via GitHub REST API
Key Features and Highlights
This workflow enables batch uploading of multiple files to a specified GitHub repository in a single operation using the GitHub REST API, overcoming the limitation of the native n8n GitHub node which only supports single-file uploads. Users only need to configure their GitHub credentials and related information to automatically execute the complete process of retrieving the latest commit data, creating a file tree, committing updates, and synchronizing the branch.
Core Problem Addressed
The official GitHub node in n8n supports only single-file uploads, which cannot meet the need for simultaneous multi-file updates. This workflow leverages the GitHub REST API to construct a new file tree and perform atomic commits of multiple files, significantly enhancing the efficiency and flexibility of automated batch operations.
Use Cases
- Batch updating documentation or code files in automated continuous integration workflows
- Synchronizing multiple files to a GitHub repository simultaneously
- Scenarios requiring batch file management through low-code platforms
- Automated project file management for developers, operations personnel, and content managers
Main Workflow Steps
- Manually trigger the workflow
- Configure GitHub access details (username, repository name, branch name, access token, commit message)
- Define the content of multiple files (with the ability to add more files as needed)
- Call the API to retrieve the latest commit SHA
- Obtain the base tree SHA to create a new tree based on it
- Create a new Git tree including all files to be uploaded
- Create a new commit linking the new tree with the parent commit
- Update the target branch to point to the latest commit SHA, completing the batch file update
Involved Systems or Services
- GitHub REST API (implemented via HTTP Request node)
- n8n automation platform (nodes used include Manual Trigger, Set, HTTP Request)
Target Audience and Value
Ideal for developers, automation engineers, project managers, and anyone needing efficient batch uploading and management of GitHub files. This workflow lowers the technical barrier for multi-file uploads and improves productivity, making it especially suitable for continuous integration and content management scenarios that require batch file commits.