Gitea icon

Gitea

Interact with Gitea via API

Actions393

Overview

This node operation allows you to create a new branch in a repository hosted on a Gitea server via its API. It is useful when you want to automate version control workflows, such as creating feature branches, hotfix branches, or release branches programmatically without manually using Git commands.

Typical use cases include:

  • Automatically creating a new branch from a specific commit, tag, or existing branch as part of a CI/CD pipeline.
  • Managing multiple repositories and branches dynamically based on external triggers or events.
  • Integrating branch creation into larger automation workflows within n8n.

Properties

Name Meaning
Owner The owner (user or organization) of the repository where the branch will be created.
Repo The name of the repository in which to create the new branch.
New Branch Name The name of the new branch to create.
Old Branch Name (Deprecated) The old branch name to create the new branch from.
Old Ref Name The reference name (branch, tag, or commit SHA) from which to create the new branch.

Note: The "Old Branch Name" property is deprecated; it is recommended to use "Old Ref Name" instead for specifying the source reference.

Output

The node outputs JSON data representing the newly created branch object returned by the Gitea API. This typically includes details such as the branch name, commit information, and related metadata.

If the API supports binary data for this operation (which is uncommon for branch creation), it would be included in the binary output field, but this node primarily deals with JSON responses.

Dependencies

  • Requires access to a Gitea instance with API enabled.
  • Needs an API authentication token configured in n8n credentials to authorize requests.
  • The base URL for the Gitea API must be set correctly in the credentials.
  • Uses the Gitea REST API endpoint for branch creation.

Troubleshooting

  • Authentication errors: Ensure the API token has sufficient permissions to create branches in the target repository.
  • Invalid repository or owner: Verify that the owner and repo names are correct and accessible by the authenticated user.
  • Branch name conflicts: If the new branch name already exists, the API will return an error; choose a unique branch name.
  • Deprecated property usage: Avoid using the deprecated "Old Branch Name" property; use "Old Ref Name" instead to specify the source reference.
  • API endpoint issues: Confirm the Gitea server URL and API path are correctly configured in the credentials.

Links and References

Discussion