Actions50
- Branch Actions
- Commit Actions
- Issue Actions
- Project Actions
- Pull Request Actions
- Repository Actions
- Tag Actions
- File Actions
- User Actions
- Webhook Actions
Overview
This node integrates with Bitbucket Data Center to manage files within repositories. Specifically, the File - Create operation allows users to create or update a file in a specified repository and project. It encodes the file content in base64 and commits it to a branch with a provided commit message.
Common scenarios where this node is beneficial include:
- Automating code or configuration file updates in Bitbucket repositories.
- Creating new source code files or documentation programmatically.
- Updating scripts or assets as part of CI/CD pipelines.
- Managing repository contents without manual intervention via the Bitbucket API.
For example, you can use this node to automatically add a new README.md file to a repository or update an existing configuration file whenever triggered by an external event.
Properties
| Name | Meaning |
|---|---|
| Authentication | Method to authenticate API requests: either "Personal Access Token" or "Basic Auth". |
| File Path | The path (including filename) where the file will be created or updated in the repository. |
| File Content | The textual content of the file to be created or updated. |
| Commit Message | The commit message describing the change for version control history. |
Output
The node outputs a JSON object representing the response from the Bitbucket Data Center API after creating or updating the file. This typically includes metadata about the committed file and the commit itself.
No binary data output is produced by this operation.
Dependencies
- Requires access to a Bitbucket Data Center instance with appropriate API permissions.
- Needs either a Personal Access Token or Basic Authentication credentials configured in n8n.
- The node uses Bitbucket's REST API endpoints under
/rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/browse/{filePath}for file operations. - The user must specify the target project key and repository slug elsewhere in the node configuration (not shown in the provided properties but required for API calls).
Troubleshooting
- Authentication errors: Ensure that the provided API token or basic auth credentials have sufficient permissions to write to the repository.
- Invalid file path: The file path must be valid and correctly URL-encoded; otherwise, the API may return 404 or 400 errors.
- Commit message missing: The commit message is required; omitting it will cause the request to fail.
- Branch parameter: If not specified, the default branch "main" is used. Make sure the branch exists.
- API request failures: Errors from the Bitbucket API are wrapped and reported with messages like
Bitbucket Data Center API request failed: <error>. Check network connectivity and API endpoint correctness.