Actions2
- Export Actions
- Import Actions
Overview
This node operation exports workflows and/or credentials from an n8n instance to a specified GitHub repository. It is useful for backing up, versioning, or sharing your n8n configurations by committing them as JSON files into a GitHub repo. Typical use cases include:
- Automating backups of workflows and credentials to GitHub.
- Keeping track of changes in workflows via Git version control.
- Sharing workflows with team members through a centralized GitHub repository.
For example, you can export all workflows tagged with "production" to a private GitHub repo branch named main, organizing the exported files under a specific folder path like workflows/.
Properties
| Name | Meaning |
|---|---|
| Repository Owner | Owner (user or organization) of the target GitHub repository |
| Repository Name | Name of the target GitHub repository |
| Branch Name | Branch in the repository where files will be committed (e.g., main or master) |
| Export | What to export: either Workflows, Credentials, or both |
| Workflows Folder Path | Folder path inside the repository to save exported workflows (e.g., workflows) |
| Credentials Folder Path | Folder path inside the repository to save exported credentials (e.g., credentials) |
| Commit Message | Commit message used when pushing changes to GitHub |
| Include Workflow IDs in Filenames | Whether to append workflow IDs to filenames when exporting workflows |
| Additional Options | Collection of optional settings: |
| - Filter Workflows by Tags | Comma-separated list of tags; only workflows containing these tags will be exported |
| - Filter Workflows by Name | String filter; only workflows whose names contain this string will be exported |
| - File Encoding | Encoding used for uploaded files: Base64 or UTF-8 |
| - Remove n8n Metadata | If true, removes n8n-specific metadata fields (like id and active) from exported workflows |
Output
The node outputs a JSON object summarizing the export operation results, including:
success: Boolean indicating overall success.workflows: Object with counts of successful exports and details of any failures.credentials: Object with counts of successful exports and details of any failures.summary: Aggregated totals of successes and failures, along with resource, operation, and timestamp.details: Information about the GitHub repository URL, branch, and paths used for workflows and credentials.- Optionally, if workflows were exported successfully, includes
exportedWorkflowswith count and export path.
No binary data output is produced by this node.
Dependencies
- Requires valid API credentials for:
- The GitHub API (a personal access token with appropriate repository permissions).
- The n8n API (an API key credential to fetch workflows and credentials).
- The GitHub repository must exist prior to export; the node cannot create repositories automatically.
- The specified branch will be created if it does not exist, based on the default branch (
mainormaster). - Network connectivity to both n8n instance and GitHub API is required.
Troubleshooting
Common Issues
- Missing or invalid credentials: The node requires both GitHub API credentials and n8n API credentials. Failure to provide these will cause errors.
- Repository does not exist: The node checks if the GitHub repository exists and will throw an error if it does not. Users must create the repository manually before running the export.
- Branch creation failure: If the specified branch does not exist and cannot be created (due to missing base branch or insufficient permissions), the export will fail.
- File conflicts during commit: Conflicts may occur if the repository or branch is out of date. The node attempts an alternative approach to resolve conflicts by uploading files individually.
- Insufficient GitHub token scopes: The GitHub token must have
reposcope to allow commits. Unauthorized errors indicate missing or incorrect token permissions.
Error Messages and Resolutions
"GitHub API credentials are required": Provide valid GitHub API credentials with necessary permissions."n8n API credentials are required": Provide valid n8n API credentials to access workflows and credentials."The repository ... does not exist. Please create it manually on GitHub before continuing.": Create the repository manually at https://github.com/new."Could not find a default branch (main or master) to create the new branch.": Ensure the repository has a default branch or create the target branch manually."Unauthorized access to GitHub. Check your personal access token and its permissions.": Verify the GitHub token's validity and scopes."Conflict when trying to push files to GitHub...": This indicates concurrent changes or outdated local state; try pulling latest changes or resolving conflicts manually.